nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #03511
[Bug 1194270] Re: Fluent Assert Is.EqualTo is acting like IsEquivalentTo
EqualTo is not expected to carry out reference equality. In that case
its purpose would be quite meaningless. EqualTo carries out equality in
a way that users would expect it. For collections, it checks equality of
the element of the collection, recursively using the same equality
logic.
EquivalentTo, on the other hand, checks collection equality using sets
semantics, that is, that the elements of the collections are equal
ignoring the order of the elements.
So, your example code is exactly how NUnit is expected to work.
Hope this explains, I'm going to close this issue unless you have
anything to add.
--
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1194270
Title:
Fluent Assert Is.EqualTo is acting like IsEquivalentTo
Status in NUnit V2 Test Framework:
New
Bug description:
Is.EqualTo should be using reference equality, however when it is of a
list type, it seems to be testing reference equality of the objects
inside (this is what CollectionAssert is for, I thought).
var dictionary1 = new Dictionary<Type, Type>();
var dictionary2 = new Dictionary<Type, Type>();
Assert.That(dictionary1, Is.EqualTo(dictionary2)); //Expect fail, but passes
Assert.IsTrue(dictionary1 == dictionary2); //Expect fail and fails.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1194270/+subscriptions
References