I convert my comment to answer on request.
Well, this fails because AreEqual
uses reference comparison. In order to make it work you need value comparison(your own custom comparison).
You can pretty much do that by implementing IEquatable interface. and keep in mind when you're implementing this interface you must override Object.Equals
and Object.GetHashCode
as well to get consistent results.
.Net framework supports doing this without implementing IEquatable
you need IEqualityComparer that should do the trick, but nunit
should have a method which takes this as a overload. Am not certain about "nunit" though.