public void Equals_WhenNull_ReturnsFalse() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); var item1 = new TestObjectA(testInput1, testInput2); item1.Equals(default(object)).Should().BeFalse(); }
public void Equals_WhenNonEntity_ReturnsFalse() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); object item1 = new TestObjectA(testInput1, testInput2); object item2 = testInput1; item1.Equals(item2).Should().BeFalse(); }
public void Equals_WhenDerivedClass_ReturnsFalse() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); var item1 = new TestObjectB(testInput1, testInput2); var item2 = new TestObjectC(testInput1, testInput2); item1.Equals(item2).Should().BeFalse(); }
public void Equals_WhenEqual_ReturnsTrue() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); var item1 = new TestObjectB(testInput1, testInput2); var item2 = new TestObjectB(testInput1, testInput2); item1.Equals(item2).Should().BeTrue(); }
public void GetHashCode_WhenCalled_ReturnsSameForSameValue() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); var expected = new TestObjectA(testInput1, testInput2).GetHashCode(); var actual = new TestObjectA(testInput1, testInput2).GetHashCode(); actual.Should().Be(expected); }
public void GetHashCode_WhenCalled_ReturnsDifferentForDifferentValue() { var testInput1 = IntegerGenerator.AnyPositiveInteger(); var testInput2 = IntegerGenerator.AnyPositiveInteger(); var testInput3 = IntegerGenerator.AnyIntegerExcept(testInput2); var test1 = new TestObjectA(testInput1, testInput2).GetHashCode(); var actual = new TestObjectA(testInput1, testInput3).GetHashCode(); actual.Should().NotBe(test1); }