Search code examples
c#nunitassertionsassertion

Is there a ShouldBeEquivalentTo() alternative for NUnit assertions?


Is there an alternative for Fluent Assertions' ShouldBeEquivalentTo() (or Machine.Specifications' ShouldBeLike()) in the NUnit (constraint-based) assertion framework?

I'm coming from the BDD-world and really liked this kind of assertions. Unfortunately, in my current project I'm not allowed to use a different (fluent) assertion library.

Would love any pointer to some NUnit extension supporting this method!


Solution

  • A possible workaround we use now is to convert both sides (the actual object and the anonymous expected object) into strings, e.g. by serializing them using JSON.NET.