Example #1
0
        public void When_asserting_an_instance_to_not_be_in_a_certain_range_but_it_is_not_it_should_throw()
        {
            // Arrange
            var subject = new ComparableOfInt(1);

            // Act
            Action action = () =>
                            subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2));

            // Assert
            action.Should().Throw <XunitException>();
        }
Example #2
0
        public void When_assertion_an_instance_to_not_be_in_a_certain_range_and_it_is_not__it_should_succeed()
        {
            // Arrange
            var subject = new ComparableOfInt(3);

            // Act
            Action action = () =>
                            subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2));

            // Assert
            action.Should().NotThrow();
        }
Example #3
0
        public void When_assertion_an_instance_to_not_be_in_a_certain_range_but_it_is_not_it_should_throw()
        {
            // Arrange
            var subject = new ComparableOfInt(2);

            // Act
            Action action = () =>
                            subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2));

            // Assert
            action.Should().Throw <XunitException>()
            .WithMessage("Expected subject to not be between*and*, but found *.");
        }
Example #4
0
        public void When_assertion_an_instance_to_be_in_a_certain_range_and_it_is_it_should_succeed()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new ComparableOfInt(1);

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action action = () =>
                            subject.Should().BeInRange(new ComparableOfInt(1), new ComparableOfInt(2));

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            action.ShouldNotThrow();
        }
Example #5
0
        public void When_assertion_an_instance_to_be_in_a_certain_range_but_it_is_not_it_should_throw()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new ComparableOfInt(3);

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action action = () =>
                            subject.Should().BeInRange(new ComparableOfInt(1), new ComparableOfInt(2));

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            action.ShouldThrow <AssertFailedException>()
            .WithMessage(
                "Expected object to be between*and*, but found *.");
        }