I can’t understand why NUnit Assert.AreEqual is failing.
var dataService = new DataService(db);
dataService.Set("Tests", "circle1", circle);
var circleData = dataService.Get("Tests", "circle1");
Assert.IsNotNull(circleData);
var circleCopy = circleData.Get();
Assert.AreEqual(circle, circleCopy);
Using NHibernate (storing serialized data, then deserializing it). I’ve inserted a breakpoint and inspected the objects in Local variables window — they are identical.
Here is the NUnit message:
Assert.AreEqual failed. Expected:<TestData.TestClassCircle>. Actual:<TestData.TestClassCircle>.
Why would this test be failing when the objects appear to be identical?
What is
CircleData? Does it overrideEquals? Looks to me like you’re cloning it, which means that you’ve got two separateCircleDatainstances. UnlessCircleDataoverridesEquals, then it will be performing a reference equality check, which will fail.