public void EqualWhenTransientIfBothOjectsAreTheSameInstance() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = p1; Assert.IsTrue(p1.Equals(p2)); }
public void NotEqualWhenSecondInstanceIsNull() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = null; Assert.IsFalse(p1.Equals(p2)); }
public void NotEqualWhenInstancesAreDifferentTypes() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); int i = 1; Assert.IsFalse(p1.Equals(i)); }
public void NotEqualWhenBothInstancesAreTransient() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = new ClassUsingGuidIdentity(); Assert.IsFalse(p1.Equals(p2)); }
public void NotEqualWhenSecondInstanceIsTransient() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = new ClassUsingGuidIdentity(); SetInstanceFieldValue(p2, "_persistenceId", Guid.NewGuid()); Assert.IsFalse(p1.Equals(p2)); }
public void OperatorEqualOverloadTest() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = new ClassUsingGuidIdentity(); Assert.IsFalse(p1.Equals(p2)); Assert.IsFalse(p1 == p2); Assert.IsTrue(p1 != p2); }
public void EqualWhenInstancesHaveSameIdentityValue() { ClassUsingGuidIdentity p1 = new ClassUsingGuidIdentity(); ClassUsingGuidIdentity p2 = new ClassUsingGuidIdentity(); Guid g = Guid.NewGuid(); SetInstanceFieldValue(p1, "_persistenceId", g); SetInstanceFieldValue(p2, "_persistenceId", g); Assert.IsTrue(p1.Equals(p2)); }