public void GetHasCode_ObjectsHaveSameValues_HashMatches() { //Arrange var sut = new FirstDescendantValueObject(); var sameValues = new FirstDescendantValueObject(); //Act int value1 = sut.GetHashCode(); int value2 = sameValues.GetHashCode(); //Assert Assert.AreEqual(value1, value2); }
public void GetHasCode_ObjectsAreTheSameReference_HashMatches() { //Arrange var sut = new FirstDescendantValueObject(); var sameObject = sut; //Act int value1 = sut.GetHashCode(); int value2 = sameObject.GetHashCode(); //Assert Assert.AreEqual(value1, value2); }
public void GetHasCode_FirstDescendantPrivateClassIsDifferent_HashAreNotEqual() { //Arrange var sut = new FirstDescendantValueObject(); var nonMatch = new FirstDescendantValueObject(); nonMatch.SetPrivateClassFieldToNull(); //Act int value1 = sut.GetHashCode(); int value2 = nonMatch.GetHashCode(); //Assert Assert.AreNotEqual(value1, value2); }
public void GetHasCode_FirstDescendantPublicClassIsDifferent_HashAreNotEqual() { //Arrange var sut = new FirstDescendantValueObject(); var nonMatch = new FirstDescendantValueObject { ClassField = new Tuple <int>(2) }; //Act int value1 = sut.GetHashCode(); int value2 = nonMatch.GetHashCode(); //Assert Assert.AreNotEqual(value1, value2); }
public void GetHasCode_FirstDescendantPublicStructIsDifferent_HashAreNotEqual() { //Arrange var sut = new FirstDescendantValueObject(); var nonMatch = new FirstDescendantValueObject { StructField = "other string" }; //Act int value1 = sut.GetHashCode(); int value2 = nonMatch.GetHashCode(); //Assert Assert.AreNotEqual(value1, value2); }