Example #1
0
        public void CompareTo_ThreePropositionsFirstBeforeSecondSecondBeforeThrid_ExpectedFirstToComeBeforeSecondAndThird()
        {
            // Arrange
            Proposition firstInOrderproposition  = new Proposition('S');
            Proposition secondInOrderProposition = new Proposition('T');
            Proposition thirdInOrderProposition  = new Proposition('X');

            // Act
            // Transitive relation
            int firstBeforeSecond = firstInOrderproposition.CompareTo(secondInOrderProposition);
            int secondBeforeThird = secondInOrderProposition.CompareTo(thirdInOrderProposition);
            int firstBeforeThrid  = firstInOrderproposition.CompareTo(thirdInOrderProposition);

            // Assert
            firstBeforeSecond.Should().BeLessThan(SAME_POSITION, "because S comes before T");
            secondBeforeThird.Should().BeLessThan(SAME_POSITION, "because T comes before X");
            firstBeforeThrid.Should().BeLessThan(SAME_POSITION, "because S < T and T < X");
        }
Example #2
0
        public void CompareTo_TwoPropositionsOfWhichOtherIsNull_ExpectedArgumentNullExceptionThrown()
        {
            // Arrange
            Proposition invalidOtherProposition = null;

            // Act
            Action act = () => VALID_PROPOSITION.CompareTo(invalidOtherProposition);

            // Assert
            act.Should().Throw <ArgumentNullException>();
        }
Example #3
0
        public void CompareTo_TwoPropositionsOfIdenticalVariable_ExpectedToBeEquivalent()
        {
            // Arrange
            Proposition proposition      = new Proposition('T');
            Proposition otherProposition = new Proposition('T');

            // Act
            int samePosition = proposition.CompareTo(otherProposition);

            // Assert
            samePosition.Should().Be(SAME_POSITION, "because their variables are the same and thus come in the same position");
        }