[TestMethod] public void ClassesInheritingOperators() { // Arrange var lhs = new ClassInheritedOperators() { ID = 1 }; var rhs = new ClassInheritedOperators() { ID = 2 }; ClassInheritedOperators?nll = null; // Act ClassInheritedOperators.Tracker.Reset(); var isLess = FullCheck.ExpectLessThan(lhs, rhs); var isEquiv = FullCheck.ExpectEquivalent(lhs, lhs); var isGreater = FullCheck.ExpectGreaterThan(rhs, lhs); var nullIsLess = FullCheck.ExpectLessThan(nll, lhs); var nullIsEquiv = FullCheck.ExpectEquivalent(nll, nll); var nullIsGreater = FullCheck.ExpectGreaterThan(lhs, nll); // Assert isLess.Should().NotHaveValue(); isEquiv.Should().NotHaveValue(); isGreater.Should().NotHaveValue(); nullIsLess.Should().NotHaveValue(); nullIsEquiv.Should().NotHaveValue(); nullIsGreater.Should().NotHaveValue(); ClassInheritedOperators.Tracker[CallKey.OpEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.OpNEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.OpLT].Should().Be(12); ClassInheritedOperators.Tracker[CallKey.OpGT].Should().Be(12); ClassInheritedOperators.Tracker[CallKey.OpLTE].Should().Be(12); ClassInheritedOperators.Tracker[CallKey.OpGTE].Should().Be(12); ClassInheritedOperators.Tracker[CallKey.StrongEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.WeakEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.Comparison].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.HashCode].Should().Be(0); }
[TestMethod] public void ClassesInheritingOperators() { // Arrange var lhs = new ClassInheritedOperators() { ID = 1 }; var rhs = new ClassInheritedOperators() { ID = 2 }; ClassInheritedOperators?nll = null; // Act ClassInheritedOperators.Tracker.Reset(); var areEqual = FullCheck.ExpectEqual(lhs, lhs); var areNotEqual = FullCheck.ExpectNotEqual(lhs, rhs); var nullAreEqual = FullCheck.ExpectEqual(nll, nll); var nullAreNotEqualL = FullCheck.ExpectNotEqual(nll, lhs); var nullAreNotEqualR = FullCheck.ExpectNotEqual(lhs, nll); // Assert areEqual.Should().NotHaveValue(); areNotEqual.Should().NotHaveValue(); nullAreEqual.Should().NotHaveValue(); nullAreNotEqualL.Should().NotHaveValue(); nullAreNotEqualR.Should().NotHaveValue(); ClassInheritedOperators.Tracker[CallKey.OpEQ].Should().Be(10); ClassInheritedOperators.Tracker[CallKey.OpNEQ].Should().Be(10); ClassInheritedOperators.Tracker[CallKey.OpLT].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.OpGT].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.OpLTE].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.OpGTE].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.StrongEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.WeakEQ].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.Comparison].Should().Be(0); ClassInheritedOperators.Tracker[CallKey.HashCode].Should().Be(0); }