コード例 #1
0
ファイル: Comparison.cs プロジェクト: justin-millman/Kvasir
        [TestMethod] public void StructsStandardOperators()
        {
            // Arrange
            var lhs = new StructStandardOperators()
            {
                ID = 1
            };
            var rhs = new StructStandardOperators()
            {
                ID = 2
            };

            // Act
            StructStandardOperators.Tracker.Reset();
            var isLess    = FullCheck.ExpectLessThan(lhs, rhs);
            var areEquiv  = FullCheck.ExpectEquivalent(lhs, lhs);
            var isGreater = FullCheck.ExpectGreaterThan(rhs, lhs);

            // Assert
            isLess.Should().NotHaveValue();
            areEquiv.Should().NotHaveValue();
            isGreater.Should().NotHaveValue();
            StructStandardOperators.Tracker[CallKey.OpEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.OpNEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.OpLT].Should().Be(6);
            StructStandardOperators.Tracker[CallKey.OpGT].Should().Be(6);
            StructStandardOperators.Tracker[CallKey.OpLTE].Should().Be(6);
            StructStandardOperators.Tracker[CallKey.OpGTE].Should().Be(6);
            StructStandardOperators.Tracker[CallKey.StrongEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.WeakEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.Comparison].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.HashCode].Should().Be(0);
        }
コード例 #2
0
        [TestMethod] public void StructsStandardOperators()
        {
            // Arrange
            var lhs = new StructStandardOperators()
            {
                ID = 1
            };
            var rhs = new StructStandardOperators()
            {
                ID = 2
            };

            // Act
            StructStandardOperators.Tracker.Reset();
            var areEqual    = FullCheck.ExpectEqual(lhs, lhs);
            var areNotEqual = FullCheck.ExpectNotEqual(lhs, rhs);

            // Assert
            areEqual.Should().NotHaveValue();
            areNotEqual.Should().NotHaveValue();
            StructStandardOperators.Tracker[CallKey.OpEQ].Should().Be(4);
            StructStandardOperators.Tracker[CallKey.OpNEQ].Should().Be(4);
            StructStandardOperators.Tracker[CallKey.OpLT].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.OpGT].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.OpLTE].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.OpGTE].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.StrongEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.WeakEQ].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.Comparison].Should().Be(0);
            StructStandardOperators.Tracker[CallKey.HashCode].Should().Be(0);
        }