public void EntitiesMustBeNotEqual_When_OneOfTheKeysIsNotEqual_DespiteOtherValues_2() { var keyProperties = GetKeyPropertiesMock(); var entity1 = new FakeClass { Id = 1, DoubleValue = 7.11, Value = "Hey Ho, Let's go!" }; var entity2 = new FakeClass { Id = 1, DoubleValue = 0.5, Value = "Hey Ho, Let's go!" }; var result = comparer.CompareEntities(entity1, entity2, keyProperties); Assert.AreEqual(false, result); }
public void EntitiesMustBeEqual_When_AllKeysAreEqual_DespiteOtherValues() { var keyProperties = GetKeyPropertiesMock(); var entity1 = new FakeClass { Id = 1, DoubleValue = 7.11, Value = "Hey Ho, Let's go!" }; var entity2 = new FakeClass { Id = 1, DoubleValue = 7.11, Value = "Seven Eleven" }; var result = comparer.CompareEntities(entity1, entity2, keyProperties); Assert.AreEqual(true, result); }
public void EntitiesMustBeNotEqual_When_KeysNotEqual_And_OneKeyIsDefault_DespiteOtherValues() { var keyProperties = GetKeyPropertiesMock(); var entity1 = new FakeClass { Id = 1, DoubleValue = 7.11, Value = "Seven Eleven" }; var entity2 = new FakeClass { Id = default(int), DoubleValue = 7.11, Value = "Seven Eleven" }; var result = comparer.CompareEntities(entity1, entity2, keyProperties); Assert.AreEqual(false, result, "Two entities with same values but different key property values are supposed to be not equal"); }
public void EntitiesMustBeEqual_When_KeysAreEqual_And_BothAreDefault() { var keyProperties = GetKeyPropertiesMock(); var entity1 = new FakeClass { Id = default(int), DoubleValue = 1.0, Value = "What's up, dog?" }; var entity2 = new FakeClass { Id = default(int), DoubleValue = 7.11, Value = "Seven Eleven" }; var result = comparer.CompareEntities(entity1, entity2, keyProperties); Assert.AreEqual(true, result); }
public void EntitiesNotMustBeEqual_When_NonForeignKeysAreNotEqual_DespiteOtherValues() { var keyProperties = GetKeyPropertiesMock(); var entity1 = new FakeClass { Id = 2, DoubleValue = 7.11, Value = "Seven Eleven" }; var entity2 = new FakeClass { Id = 1, DoubleValue = 7.11, Value = "Seven Eleven" }; var result = comparer.CompareEntities(entity1, entity2, keyProperties); Assert.AreEqual(false, result); }