Cannot find Assert.Fail and Assert.Pass or equivalent

后端 未结 4 1078
太阳男子
太阳男子 2021-02-04 23:05

I used to use these in NUnit and they are really useful. Any idea how to do something like that?

EDIT, CODE SAMPLE:

        bool condition = false;//woul         


        
4条回答
  •  忘掉有多难
    2021-02-04 23:30

    Just throw an exception to satisfy both requirements (exiting a nested loop and an alternative to the missing Assert.Fail method). Only issue is there is no decent base exception (e.g. TestException) to use in order to avoid getting warnings about using the base Exception class, so something more directed like an InvalidOperationException is probably a good choice.

提交回复
热议问题