public void GetHashCode_ConsidersPublicFields() { var value1 = new TestValue { Property2 = 2 }; var value2 = new TestValue { Property2 = 2, Field = 4 }; Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode()); }
public void GetHashCode_NotEqualForDistinctObjects_2() { var value1 = new TestValue { Property1 = "string", Property2 = 4 }; var value2 = new TestValue { Property1 = "String", Property2 = 4 }; Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode()); }
public void GetHashCode_HandlesNull() { var value1 = new TestValue { Property2 = 2 }; var value2 = new TestValue { Property2 = 5 }; Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode()); }
public void GetHashCode_AlwaysEqualForEqualObjects() { var value1 = new TestValue { Property1 = "string", Property2 = 4 }; var value2 = new TestValue { Property1 = "string", Property2 = 4 }; Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode()); }