Пример #1
0
        public void SubtitleMatching_should_throw_ThumbnailCardAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
        }
Пример #2
0
        public void SubtitleMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #3
0
        public void SubtitleMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #4
0
        public void SubtitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Subtitle_of_any_card()
        {
            IList <string> matches;

            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

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

            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #6
0
        public void SubtitleMatching_should_not_output_matches_when_regex_does_not_match_Subtitle_of_any_cards()
        {
            IList <string> matches = null;

            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            var sut = new ThumbnailCardSetAssertions(cards);

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

            act.ShouldThrow <ThumbnailCardAssertionFailedException>();
            matches.Should().BeNull();
        }
Пример #7
0
        public void Extracted_thumbnail_cards_are_used_to_create_thumbnail_card_set_assertions()
        {
            var thumbnailCards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            _extractor.ExtractCards <ThumbnailCard>(Arg.Any <IEnumerable <Activity> >()).Returns(thumbnailCards);

            var sut = new ActivitySetAttachmentAssertions(ActivityTestData.CreateRandomActivities());

            var result = sut.OfTypeThumbnailCard();

            result.Should().BeAssignableTo <ThumbnailCardSetAssertions>();
            var assertions = (ThumbnailCardSetAssertions)result;

            assertions.ThumbnailCards.ShouldBeEquivalentTo(thumbnailCards);
        }
Пример #8
0
        public void SubtitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Subtitle_on_multiple_cards()
        {
            IList <string> matches;

            var cards = ThumbnailCardTestData.CreateRandomThumbnailCards();

            cards.Add(new ThumbnailCard(subtitle: "some text"));
            cards.Add(new ThumbnailCard(subtitle: "same text"));

            var sut = new ThumbnailCardSetAssertions(cards);

            sut.SubtitleMatching(".*", @"(s[oa]me) (text)", out matches);

            matches.Should().Contain("some", "same", "text");
        }