Search code examples
c#unit-testingfluent-assertions

Opposite of ShouldBeEquivalentTo


I am writing unit tests in c#. ShouldBeEquivalentTo makes sense for positive cases, but for negative cases what do you use> I have not found anything like ShouldNotBeEquivalentTo.


Solution

  • It doesn't exist. The best you can do is to wrap the call to ShouldBeEquivalentTo and catch the AssertFailedException. You could create an extension method for that.