Bug of the day...
Using MbUnit 2.4, this test pass:
Guid g = Guid.Empty; Assert.AreEqual(Guid.Empty, g); Assert.AreNotEqual(Guid.Empty, g);
Using MbUnit 2.4, this test pass:
Guid g = Guid.Empty; Assert.AreEqual(Guid.Empty, g); Assert.AreNotEqual(Guid.Empty, g);
And 4 more posts are pending...
There are posts all the way to Feb 17, 2025
Comments
well that's helpful
Yep, ran into that one a while ago...
http://code.google.com/p/mb-unit/issues/detail?id=114
It's funny that I have stumbled in the exactly same bug today.
Well, seems almost no one is actually using AreNotEqual if this lived to the 2.4.
Thanks Oren, I'll need to investigate this more but I think in the absence of an assert for Guid that MbUnit is casting to object and then equating as a null. The AreNotEqual has this gem.
if (expected == null ^ actual == null)
return;
As both become null in the cast it passes. Thats a complete guess at the moment until I can investigate more. Always fun.
Andy
Maybe it been updated since the version I'm running (1.0.2700) but the real problem I see is that AreEqual(object, object) uses the object's Equals() methods (via ObjectsEqual) which is customized to the class, while AreNotEqual just uses !(obj==obj) which ultimately just Object.ReferenceEquals.
That's because GUIDs are so unique that even two identical GUIDs are not quite equal. Duh.
That's nothing compared to my bug of the day:
try running this piece of code in the immediate window and then in the body of a funcion.
bool a = object.ReferenceEquals("A","A")
a would be true as the compiler would have inturned the string "A"
Comment preview