Beispiel #1
0
        public void TitleMatching_should_throw_HeroCardAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var cards = HeroCardTestData.CreateRandomHeroCards();

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
        }
Beispiel #2
0
        public void TitleMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var cards = HeroCardTestData.CreateRandomHeroCards();

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Beispiel #3
0
        public void TitleMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var cards = HeroCardTestData.CreateRandomHeroCards();

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Beispiel #4
0
        public void TitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Title_of_any_card()
        {
            IList <string> matches;

            var cards = HeroCardTestData.CreateRandomHeroCards();

            var sut = new HeroCardSetAssertions(cards);

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

            matches.Should().BeNull();
        }
Beispiel #5
0
        public void TitleMatching_should_not_output_matches_when_regex_does_not_match_Title_of_any_cards()
        {
            IList <string> matches = null;

            var cards = HeroCardTestData.CreateRandomHeroCards();

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
            matches.Should().BeNull();
        }
Beispiel #6
0
        public void Extracted_hero_cards_are_used_to_create_hero_card_set_assertions()
        {
            var heroCards = HeroCardTestData.CreateRandomHeroCards();

            _extractor.ExtractCards <HeroCard>(Arg.Any <IEnumerable <Activity> >()).Returns(heroCards);

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

            var result = sut.OfTypeHeroCard();

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

            assertions.HeroCards.ShouldBeEquivalentTo(heroCards);
        }
Beispiel #7
0
        public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Title_on_multiple_cards()
        {
            IList <string> matches;

            var cards = HeroCardTestData.CreateRandomHeroCards();

            cards.Add(new HeroCard(title: "some text"));
            cards.Add(new HeroCard(title: "same text"));

            var sut = new HeroCardSetAssertions(cards);

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

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