Closed
Description
With the code changes #2118 for Issue2097, the test below still will fail, since when the NUnitEqualityComparer
does each item comparison, the property compareAsCollection
is still true
, so it will not get in the condition, which ignoring the IEquatable
of the element and will fail the assertion.
namespace Nunit3TestsSamples {
[TestFixture]
class TestSample1 {
[Test]
public void test() {
var set1 = new List<TestObject>() {
new TestObject { Value = "test1" },
new TestObject { Value = "test2" },
new TestObject { Value = "test3" }
};
var set2 = new List<TestObject>() {
new TestObject { Value = "test1" },
new TestObject { Value = "test2" },
new TestObject { Value = "test3" }
};
CollectionAssert.AreEqual( set1, set2 );
}
class TestObject : IEquatable<TestObject> {
public string Value { get; set; }
public bool Equals( TestObject other ) {
return Value.Equals( other.Value );
}
}
}
}