MOQ - verify exception was thrown

前端 未结 7 1874
暗喜
暗喜 2021-01-07 16:22

I working with MOQ framework for my testing. I have a scenario in which I expect a fault exception to be thrown. How can I verify it was thrown?

public void          


        
7条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 17:11

    Ok so I solved it in the following way.

    Since the exception broke my test I put the method call in the Because block in try-catch.

    Then I could use a simple Verify.

    Thanks to all helpers...

提交回复
热议问题