c# - Comparing Two objects using Assert.AreEqual() -
I'm writing test cases for the first time in Visual Studio # I is a method that gives a list of objects And I want to compare it with the second list of items using the I tried to do this, but the claim fails even if both objects are the same. / P> I want to know that this method is comparing the contents of two parameter references or the object, Do I have to overload the operator If you are using starting with version 2.2, special provision has also been made to compare single dimensional arrays. Two arrays will be considered equivalent to the dependent. If they are the same length and the related elements are equal to each. Note: Multi-directional arrays, arrays arrays, and other collection types such as ArrayList are not currently supported. In general, if you are comparing two objects and you want the values based parallelism you must override the To achieve what you are looking for: And in your unit test: assert.AreEqual () method.
== To work this?
NUnit then this is the same documentation That
similarity method.
class person {public string firstname {get; Set;} public string last name {get; Set;} Public override baul par (object other) {var toCompareWith = as another person; If (toCompare == empty) return false; Return it. First name == Comprehensive with: first name & amp; Amp; This.Lastname == toCompareWith.Lastname; }}
Fear. Reequal (Expected list. ToArray (), Actual list. ToArray ());
Comments
Post a Comment