I have a class MyCustomClass:
public MyCustomClass
{
public MyCustomClass()
{
MyObject = new List<MyCustomObject>();
}
public List<MyCustomObject> MyObject {get; set;}
}
In the Test:
List<MyCustomObject> aux = new List<MyCustomObject>();
MyCustomClass oClass = new MyCustomClass();
Assert.AreEqual(aux, oClass.MyObject)
The test has failed, why? Every property, static member, etc are the same.
In this case
Assert.AreEqualwill check to see if the two objects are the same, and they’re not. You should useCollectionAssert.AreEqualinstead, which will return true if the two “have the same elements in the same order and quantity.”