Compare equality between two objects in NUnit
Do not override Equals just for testing purposes. It’s tedious and affects domain logic. Instead, Use JSON to compare the object’s data No additional logic on your objects. No extra tasks for testing. Just use this simple method: public static void AreEqualByJson(object expected, object actual) { var serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); var expectedJson = serializer.Serialize(expected); … Read more