OK so I\'m fairly new to unit testing and everything is going well until now. I\'m simplifying my problem here, but basically I have the following:
[Test]
pu
A very simple way to get this test to work is to only create the MyOtherClass
instance once. That way, when comparing the item in the two lists they will be "equal" (because they reference the same object). If you do this, CollectionAssert
will work just fine.
[Test]
public void ListTest()
{
var thing = new MyOtherClass();
var expected = new List();
expected.Add(thing);
var actual = new List();
actual.Add(thing);
CollectionAssert.AreEqual(expected,actual);
}
If you don't this though, you'll need to implement IEquatable
in MyOtherClass
or override Equals
to define what makes two instances of that class the "same".