Cannot find Assert.Fail and Assert.Pass or equivalent

后端 未结 4 988
太阳男子
太阳男子 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:28

    The documentation includes a comparison chart including this:

    Fail - xUnit.net alternative: Assert.True(false, "message")

    (It doesn't show Assert.Pass, and I've never used that myself, but I suspect the alternative is just to return from the test. Of course that doesn't help if you want to throw it in a nested method call. My suspicion is that it's not very frequently used in NUnit, hence its absence in the comparison chart.)

提交回复
热议问题