Answer the question
In order to leave comments, you need to log in
What are the tests (analogues of Assert) for .NET for reference data types?
Suppose two identical objects are created by field values, the usual Assert.AreEquals for MSTest will return an error as expected, since it compares references to objects and not the values of the objects themselves
. How to compare two objects by their field values?
Answer the question
In order to leave comments, you need to log in
The easiest option is to serialize to Json and compare. You can
also use the Verify library: https://github.com/VerifyTests/Verify
Or something for deep comparison: https://github.com/GregFinzer/Compare-Net-Objects
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question