public void HashCodeIsDifferentWhenAnyMemberChanges(Type memberType, Type operandType, object min, object max) { // Arrange var etalonHashCode = new RangedRequest(typeof(long), typeof(int), 1, 3).GetHashCode(); var sut = new RangedRequest(memberType, operandType, min, max); // Act var newHashCode = sut.GetHashCode(); // Assert Assert.NotEqual(etalonHashCode, newHashCode); }
public void HashCodeIsDifferentWhenAnyMemberChanges(Type memberType, Type operandType, object min, object max) { // Fixture setup var etalonHashCode = new RangedRequest(typeof(long), typeof(int), 1, 3).GetHashCode(); var sut = new RangedRequest(memberType, operandType, min, max); // Exercise system var newHashCode = sut.GetHashCode(); // Verify outcome Assert.NotEqual(etalonHashCode, newHashCode); // Teardown }
public void HashCodeIsSameWhenAllMembersAreSame() { // Arrange var memberType = typeof(decimal); var operandType = typeof(int); var min = 1; var max = 3; var sut1 = new RangedRequest(memberType, operandType, min, max); var sut2 = new RangedRequest(memberType, operandType, min, max); // Act var hash1 = sut1.GetHashCode(); var hash2 = sut2.GetHashCode(); // Assert Assert.Equal(hash1, hash2); }
public void HashCodeIsSameWhenAllMembersAreSame() { // Fixture setup var memberType = typeof(decimal); var operandType = typeof(int); var min = 1; var max = 3; var sut1 = new RangedRequest(memberType, operandType, min, max); var sut2 = new RangedRequest(memberType, operandType, min, max); // Exercise system var hash1 = sut1.GetHashCode(); var hash2 = sut2.GetHashCode(); // Verify outcome Assert.Equal(hash1, hash2); // Teardown }