Пример #1
0
        public void TitleMatching_should_throw_CardActionAssertionFailedException_for_non_matching_regexes(string title, string regex)
        {
            var cardAction = new CardAction(title: title);

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching(regex);

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Пример #2
0
        public void TitleMatching_should_pass_regardless_of_case(string title, string regex)
        {
            var cardAction = new CardAction(title: title);

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
Пример #3
0
        public void TitleMatching_should_pass_when_using_standard_regex_features(string title, string regex)
        {
            var cardAction = new CardAction(title: title);

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
Пример #4
0
        public void TitleMatching_should_throw_CardActionAssertionFailedException_when_title_is_null()
        {
            var cardAction = new CardAction();

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching("anything");

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Пример #5
0
        public void TitleMatching_should_pass_if_regex_exactly_matches_image_title(string titleAndRegex)
        {
            var cardAction = new CardAction(title: titleAndRegex);

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching(titleAndRegex);

            act.ShouldNotThrow <Exception>();
        }
Пример #6
0
        public void TitleMatching_should_throw_ArgumentNullException_when_regex_is_null()
        {
            var cardAction = new CardAction(title: "some text");

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching(null);

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #7
0
        public void TitleMatching_should_throw_ArgumentNullException_when_regex_is_null_when_matching_groups()
        {
            var cardAction = new CardAction(title: "some text");

            var sut = new CardActionAssertions(cardAction);

            IList <string> matches;
            Action         act = () => sut.TitleMatching(null, "(.*)", out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #8
0
        public void TitleMatching_should_throw_CardActionAssertionFailedException_when_trying_to_capture_groups_but_title_is_null()
        {
            IList <string> matches;
            var            cardAction = new CardAction();

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching("anything", "(.*)", out matches);

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Пример #9
0
        public void TitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_title()
        {
            IList <string> matches;

            var cardAction = new CardAction(title: "some text");

            var sut = new CardActionAssertions(cardAction);

            sut.TitleMatching("some text", "(non matching)", out matches);

            matches.Should().BeNull();
        }
Пример #10
0
        public void TitleMatching_should_output_matches_when_groupMatchingRegex_matches_title()
        {
            IList <string> matches;

            const string someText   = "some text";
            var          cardAction = new CardAction(title: someText);

            var sut = new CardActionAssertions(cardAction);

            sut.TitleMatching(someText, $"({someText})", out matches);

            matches.First().Should().Be(someText);
        }
Пример #11
0
        public void TitleMatching_should_not_output_matches_when_regex_does_not_match_title()

        {
            IList <string> matches = null;

            var cardAction = new CardAction(title: "some text");

            var sut = new CardActionAssertions(cardAction);

            Action act = () => sut.TitleMatching("non matching regex", "(some text)", out matches);

            act.ShouldThrow <CardActionAssertionFailedException>();
            matches.Should().BeNull();
        }
Пример #12
0
        public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_title_several_times()
        {
            IList <string> matches;

            const string someText   = "some text";
            var          cardAction = new CardAction(title: someText);

            var sut = new CardActionAssertions(cardAction);

            var match1 = "some";
            var match2 = "text";

            sut.TitleMatching(someText, $"({match1}) ({match2})", out matches);

            matches.Should().Contain(match1, match2);
        }