예제 #1
0
            public void When_subject_is_greater_than_another_subject_and_greater_than_or_equal_is_expected_it_should_not_throw()
            {
                // Arrange
                var subject = new ComparableOfString("xyz");
                var other   = new ComparableOfString("abc");

                // Act
                Action act = () => subject.Should().BeGreaterThanOrEqualTo(other);

                // Assert
                act.Should().NotThrow();
            }
예제 #2
0
            public void When_subject_is_less_than_another_subject_and_less_than_or_equal_is_expected_it_should_not_throw()
            {
                // Arrange
                var subject = new ComparableOfString("City");
                var other   = new ComparableOfString("World");

                // Act
                Action act = () => subject.Should().BeLessThanOrEqualTo(other);

                // Assert
                act.Should().NotThrow();
            }
예제 #3
0
            public void When_subject_is_equal_to_another_subject_and_expected_to_be_greater_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("efg");
                var other   = new ComparableOfString("efg");

                // Act
                Action act = () => subject.Should().BeGreaterThan(other);

                // Assert
                act.Should().Throw <XunitException>();
            }
예제 #4
0
            public void When_assertion_an_instance_not_to_be_null_and_it_is_not_null_it_should_succeed()
            {
                // Arrange
                var subject = new ComparableOfString("");

                // Act
                Action action = () =>
                                subject.Should().NotBeNull();

                // Assert
                action.Should().NotThrow();
            }
예제 #5
0
            public void When_subect_is_not_ranked_equal_to_another_subject_and_that_is_expected_it_should_not_throw()
            {
                // Arrange
                var subject = new ComparableOfString("Hello");
                var other   = new ComparableOfString("Hi");

                // Act
                Action act = () => subject.Should().NotBeRankedEquallyTo(other);

                // Assert
                act.Should().NotThrow();
            }
예제 #6
0
        public void When_subject_is_equal_to_another_subject_and_that_is_equal_or_greater_it_should_not_throw()
        {
            // Arrange
            var subject = new ComparableOfString("def");
            var other   = new ComparableOfString("def");

            // Act
            Action act = () => subject.Should().BeGreaterOrEqualTo(other);

            // Assert
            act.Should().NotThrow();
        }
예제 #7
0
            public void When_assertion_an_instance_not_to_be_null_and_it_is_null_it_should_throw()
            {
                // Arrange
                ComparableOfString subject = null;

                // Act
                Action action = () =>
                                subject.Should().NotBeNull();

                // Assert
                action.Should().Throw <XunitException>()
                .WithMessage("Expected subject not to be <null>.");
            }
예제 #8
0
            public void When_assertion_an_instance_to_be_null_and_it_is_not_null_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("");

                // Act
                Action action = () =>
                                subject.Should().BeNull();

                // Assert
                action.Should().Throw <XunitException>()
                .WithMessage("Expected subject to be <null>, but found*");
            }
예제 #9
0
            public void When_subject_is_less_than_another_subject_and_that_is_not_expected_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("abc");
                var other   = new ComparableOfString("def");

                // Act
                Action act = () => subject.Should().BeGreaterThanOrEqualTo(other, "'d' is bigger then 'a'");

                // Assert
                act
                .Should().Throw <XunitException>()
                .WithMessage("Expected subject*abc*to be greater than or equal to*def*because 'd' is bigger then 'a'.");
            }
예제 #10
0
            public void When_subject_is_not_greater_than_another_subject_but_that_is_expected_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("abc");
                var other   = new ComparableOfString("def");

                // Act
                Action act = () => subject.Should().BeGreaterThan(other, "'a' is smaller then 'e'");

                // Assert
                act
                .Should().Throw <XunitException>()
                .WithMessage("Expected subject*abc*to be greater than*def*because 'a' is smaller then 'e'.");
            }
예제 #11
0
            public void When_subject_is_greater_than_another_subject_and_that_is_not_expected_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("World");
                var other   = new ComparableOfString("City");

                // Act
                Action act = () => subject.Should().BeLessThanOrEqualTo(other, "we want to order them");

                // Assert
                act
                .Should().Throw <XunitException>()
                .WithMessage("Expected subject*World*to be less than or equal to*City*because we want to order them.");
            }
예제 #12
0
            public void When_subject_is_not_less_than_another_subject_but_that_is_expected_it_should_throw()
            {
                // Arrange
                var subject = new ComparableOfString("World");
                var other   = new ComparableOfString("City");

                // Act
                Action act = () => subject.Should().BeLessThan(other, "a city is smaller than the world");

                // Assert
                act
                .Should().Throw <XunitException>()
                .WithMessage("Expected subject*World*to be less than*City*because a city is smaller than the world.");
            }
예제 #13
0
        public void When_subject_is_ranked_equal_to_another_subject_but_that_is_not_expected_it_should_throw()
        {
            // Arrange
            var subject = new ComparableOfString("Lead");
            var other   = new ComparableOfString("Lead");

            // Act
            Action act = () => subject.Should().NotBeRankedEquallyTo(other, "they represent different concepts");

            // Assert
            act
            .Should().Throw <XunitException>()
            .WithMessage("Expected subject*Lead*not to be ranked as equal to*Lead*because they represent different concepts.");
        }
예제 #14
0
        public void When_subject_is_not_ranked_equal_to_another_subject_but_that_is_expected_it_should_throw()
        {
            // Arrange
            var subject = new ComparableOfString("42");
            var other   = new ComparableOfString("Forty two");

            // Act
            Action act = () => subject.Should().BeRankedEquallyTo(other, "they represent the same number");

            // Assert
            act
            .Should().Throw <XunitException>()
            .WithMessage("Expected subject*42*to be ranked as equal to*Forty two*because they represent the same number.");
        }