示例#1
0
        public void WithButtons_should_return_CardActionSetAssertions()
        {
            var buttons       = CardActionTestData.CreateRandomCardActions();
            var thumbnailCard = new ThumbnailCard(buttons: buttons);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
示例#2
0
        public void WithCardImage_should_return_CardImageAssertions()
        {
            var cardImages    = CardImageTestData.CreateRandomCardImages();
            var thumbnailCard = new ThumbnailCard(images: cardImages);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            sut.WithCardImage().Should().BeAssignableTo <CardImageSetAssertions>().And.NotBeNull();
        }
示例#3
0
        public void WithTapAction_should_return_CardActionAssertions()
        {
            var tap           = new CardAction();
            var thumbnailCard = new ThumbnailCard(tap: tap);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            sut.WithTapAction().Should().BeAssignableTo <CardActionAssertions>().And.NotBeNull();
        }
示例#4
0
        public void SubtitleMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var card = new ThumbnailCard();

            var sut = new ThumbnailCardAssertions(card);

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

            act.ShouldThrow <ArgumentNullException>();
        }
示例#5
0
        public void SubtitleMatching_should_throw_ThumbnailCardAssertionFailedException_when_text_is_null()
        {
            var card = new ThumbnailCard();

            var sut = new ThumbnailCardAssertions(card);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
        }
示例#6
0
        public void TextMatching_should_pass_regardless_of_case(string cardText, string regex)
        {
            var thumbnailCard = new ThumbnailCard(text: cardText);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            act.ShouldNotThrow <Exception>();
        }
示例#7
0
        public void SubtitleMatching_should_pass_if_regex_exactly_matches_message_Subtitle(string cardSubtitleAndRegex)
        {
            var thumbnailCard = new ThumbnailCard(subtitle: cardSubtitleAndRegex);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            Action act = () => sut.SubtitleMatching(cardSubtitleAndRegex);

            act.ShouldNotThrow <Exception>();
        }
示例#8
0
        public void SubtitleMatching_should_pass_regardless_of_case(string cardSubtitle, string regex)
        {
            var thumbnailCard = new ThumbnailCard(subtitle: cardSubtitle);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            act.ShouldNotThrow <Exception>();
        }
示例#9
0
        public void SubtitleMatching_should_throw_ThumbnailCardAssertionFailedException_for_non_matching_regexes(string cardSubtitle, string regex)
        {
            var thumbnailCard = new ThumbnailCard(subtitle: cardSubtitle);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
        }
示例#10
0
        public void SubtitleMatching_should_pass_when_using_standard_regex_features(string cardSubtitle, string regex)
        {
            var thumbnailCard = new ThumbnailCard(subtitle: cardSubtitle);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            act.ShouldNotThrow <Exception>();
        }
示例#11
0
        public void TextMatching_should_pass_if_regex_exactly_matches_message_Text(string cardTextAndRegex)
        {
            var thumbnailCard = new ThumbnailCard(text: cardTextAndRegex);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            Action act = () => sut.TextMatching(cardTextAndRegex);

            act.ShouldNotThrow <Exception>();
        }
示例#12
0
        public void SubtitleMatching_should_throw_ThumbnailCardAssertionFailedException_when_trying_to_capture_groups_but_text_is_null()
        {
            IList <string> matches;
            var            card = new ThumbnailCard();

            var sut = new ThumbnailCardAssertions(card);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
        }
示例#13
0
        public void TextMatching_should_throw_ArgumentNullException_if_when_capturing_groups_regex_is_null()
        {
            IList <string> matches;

            var card = new ThumbnailCard();

            var sut = new ThumbnailCardAssertions(card);

            Action act = () => sut.TextMatching(null, "(.*)", out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
示例#14
0
        public void SubtitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text()
        {
            IList <string> matches;

            var thumbnailCard = new ThumbnailCard(subtitle: "some text");

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            matches.Should().BeNull();
        }
示例#15
0
        public void SubtitleMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var card = new ThumbnailCard();

            var sut = new ThumbnailCardAssertions(card);

            Action act = () => sut.SubtitleMatching("(.*)", null, out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
示例#16
0
        public void SubtitleMatching_should_output_matches_when_groupMatchingRegex_matches_text()
        {
            IList <string> matches;

            const string someText      = "some text";
            var          thumbnailCard = new ThumbnailCard(subtitle: someText);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            matches.First().Should().Be(someText);
        }
示例#17
0
        public void SubtitleMatching_should_not_output_matches_when_regex_does_not_match_text()
        {
            IList <string> matches = null;

            var thumbnailCard = new ThumbnailCard(subtitle: "some text");

            var sut = new ThumbnailCardAssertions(thumbnailCard);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
            matches.Should().BeNull();
        }
示例#18
0
        public void SubtitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times()
        {
            IList <string> matches;

            const string someText      = "some text";
            var          thumbnailCard = new ThumbnailCard(subtitle: someText);

            var sut = new ThumbnailCardAssertions(thumbnailCard);

            const string match1 = "some";
            const string match2 = "text";

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

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