Hi,
I'd like to know whether there is a way to compare two objects in MBUnit so that the test is passed when the objects "look" the same, even if those are distinct instances?
For example:
[TestFixture]
class ComparisonTestFixture
{
class foo
{
public string bar;
}
[Test]
public void ComparisonTest()
{
foo foo1 = new foo()
{
bar = "baz"
};
foo foo2 = new foo()
{
bar = "baz"
};
//This assertion should be successful, but it isn't
//*** Failures ***
//Expected values to be equal.
//Expected Value & Actual Value : {foo: bar = "zzz...."}
//Remark : Both values look the same when formatted but they are distinct instances.
Assert.AreEqual(foo1,foo2);
}
}
Assert.AreEqual() does not work for this (test fails, see source code above). Since it remarks that "Both values look the same when formatted but they are distinct instances", I figure there must be some way to do this built into MbUnit already without serializing the objects to XML in my own code.
Do I have to write my own Assert extension method for this?