Ejemplo n.º 1
0
        public void WithTapAction_should_return_CardActionAssertions()
        {
            var tap       = new CardAction();
            var heroCards = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(tap: tap);

            var sut = new HeroCardSetAssertions(heroCards);

            sut.WithTapAction().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 2
0
        public void WithCardImage_should_return_CardImageAssertions()
        {
            var cardImages = CardImageTestData.CreateRandomCardImages();
            var heroCards  = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(images: cardImages);

            var sut = new HeroCardSetAssertions(heroCards);

            sut.WithCardImage().Should().BeAssignableTo <CardImageSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 3
0
        public void WithButtons_should_return_CardActionSetAssertions()
        {
            var buttons   = CardActionTestData.CreateRandomCardActions();
            var heroCards = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(buttons: buttons);

            var sut = new HeroCardSetAssertions(heroCards);

            sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 4
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>();
        }
Ejemplo n.º 5
0
        public void TitleMatching_should_pass_when_using_standard_regex_features(string cardTitle, string regex)
        {
            var cards = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(title: cardTitle);

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 6
0
        public void TitleMatching_should_pass_if_regex_exactly_matches_Title_of_at_least_1_card_regardless_of_case(string cardTitle, string regex)
        {
            var cards = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(title: cardTitle);

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 7
0
        public void TitleMatching_should_pass_if_regex_exactly_matches_message_Title_of_one_card(string cardTitleAndRegex)
        {
            var cards = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(title: cardTitleAndRegex);

            var sut = new HeroCardSetAssertions(cards);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 8
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>();
        }
Ejemplo n.º 9
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>();
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
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();
        }
Ejemplo n.º 12
0
        public void TitleMatching_should_output_matches_when_groupMatchingRegex_matches_Title_of_any_card()
        {
            IList <string> matches;

            const string someTitle = "some text";
            var          cards     = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(title: someTitle);

            var sut = new HeroCardSetAssertions(cards);

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

            matches.First().Should().Be(someTitle);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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");
        }
Ejemplo n.º 15
0
        public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Title_several_times_for_a_single_card()
        {
            IList <string> matches;

            const string someTitle = "some text";
            var          cards     = HeroCardTestData.CreateHeroCardSetWithOneCardThatHasSetProperties(title: someTitle);

            var sut = new HeroCardSetAssertions(cards);

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

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

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