public void ShouldPreventNullCoaleseTest() { bool result; object objA, objB; DataTypeFascade dataTypeFascade; dataTypeFascade = new DataTypeFascade(); // both null objA = null; objB = (int)0; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsFalse(result); }
public void ShouldCheckObjectsEqualValueSemanticsTest() { bool result; object objA, objB; DataTypeFascade dataTypeFascade; dataTypeFascade = new DataTypeFascade(); // both null objA = null; objB = null; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsTrue(result); // objA null, objB not null objA = null; objB = "not null string"; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsFalse(result); // objA not null, objB null objA = "not null string"; objB = null; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsFalse(result); // objA == objB objA = 100; objB = 100; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsTrue(result); // objA != objB objA = 100; objB = -100; result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB); Assert.IsFalse(result); }