Exemple #1
0
        public void CompareTo_ComparableValueObjectWithGreaterComparableComponents_ReturnsLessThanZero(ComparableValueObject a,
                                                                                                       ComparableValueObject b)
        {
            // Act
            var result = a.CompareTo(b);

            // Assert
            result.Should().BeNegative("because argument has greater comparable components than the current object.");
        }
Exemple #2
0
        public void CompareTo_ComparableValueObjectWithSmallerComparableComponents_ReturnsGreaterThanZero(ComparableValueObject a,
                                                                                                          ComparableValueObject b)
        {
            // Act
            var result = a.CompareTo(b);

            // Assert
            result.Should().BePositive("argument has smaller comparable components than the current object.");
        }
Exemple #3
0
        public void CompareTo_ComparableValueObjectWithSameComparableComponents_ReturnsZero(ComparableValueObject a,
                                                                                            ComparableValueObject b)
        {
            // Act
            var result = a.CompareTo(b);

            // Assert
            result.Should().Be(0, "because argument has same comparable components than the current object.");
        }
Exemple #4
0
        public void CompareTo_PermuteComparableValueObjectsWithSameComparableComponents_ReturnsSameValue(ComparableValueObject a,
                                                                                                         ComparableValueObject b)
        {
            // Act
            var result1 = a.CompareTo(b);
            var result2 = b.CompareTo(a);

            // Assert
            result1.Should().Be(result2, "because if a.CompareTo(b) returns zero, then b.CompareTo(a) must also return zero.");
        }
Exemple #5
0
        public void CompareTo_ComparableValueObjectWithNullReference_ReturnsGreaterThanZero()
        {
            // Arrange
            ComparableValueObject a = NewComparableValueObject();
            ComparableValueObject b = null;
            // Act
            var result = a.CompareTo(b);

            // Assert
            result.Should().BePositive("because argument is null.");
        }
Exemple #6
0
        public void CompareTo_PermuteComparableValueObjectsWithDifferentComparableComponents_ReturnsInverseValues(ComparableValueObject a,
                                                                                                                  ComparableValueObject b)
        {
            // Act
            var result1 = a.CompareTo(b);
            var result2 = -b.CompareTo(a);

            // Assert
            result1.Should().Be(result2,
                                "because if a.CompareTo(b) returns a value other than zero, then b.CompareTo(a) must return a value of the opposite sign.");
        }