J
jmagaram
Why does the call to Debug.AssertReferenceEquals not raise a UnitTesting
exception but the call to Assert.IsTrue does? This inconsistency
(Assert.ReferenceEquals returns a bool and Assert.IsTrue returns a void and
throws) is dangerous because your unit tests may pass but in actuality they
fail.
class TestClass { }
TestClass a = new TestClass();
TestClass b = new TestClass();
Assert.ReferenceEquals(a, b);
Assert.IsTrue(object.ReferenceEquals(a, b));
exception but the call to Assert.IsTrue does? This inconsistency
(Assert.ReferenceEquals returns a bool and Assert.IsTrue returns a void and
throws) is dangerous because your unit tests may pass but in actuality they
fail.
class TestClass { }
TestClass a = new TestClass();
TestClass b = new TestClass();
Assert.ReferenceEquals(a, b);
Assert.IsTrue(object.ReferenceEquals(a, b));