Ejemplo n.º 1
0
        public void WithTapAction_should_return_CardActionAssertions()
        {
            var tap      = new CardAction();
            var heroCard = new HeroCard(tap: tap);

            var sut = new HeroCardAssertions(heroCard);

            sut.WithTapAction().Should().BeAssignableTo <CardActionAssertions>().And.NotBeNull();
        }
Ejemplo n.º 2
0
        public void WithButtons_should_return_CardActionSetAssertions()
        {
            var buttons  = CardActionTestData.CreateRandomCardActions();
            var heroCard = new HeroCard(buttons: buttons);

            var sut = new HeroCardAssertions(heroCard);

            sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 3
0
        public void WithCardImage_should_return_CardImageAssertions()
        {
            var cardImages = CardImageTestData.CreateRandomCardImages();
            var heroCard   = new HeroCard(images: cardImages);

            var sut = new HeroCardAssertions(heroCard);

            sut.WithCardImage().Should().BeAssignableTo <CardImageSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 4
0
        public void TitleMatching_should_throw_HeroCardAssertionFailedException_for_non_matching_regexes(string cardTitle, string regex)
        {
            var heroCard = new HeroCard(title: cardTitle);

            var sut = new HeroCardAssertions(heroCard);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
        }
Ejemplo n.º 5
0
        public void TitleMatching_should_pass_regardless_of_case(string cardTitle, string regex)
        {
            var heroCard = new HeroCard(title: cardTitle);

            var sut = new HeroCardAssertions(heroCard);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 6
0
        public void TitleMatching_should_pass_when_using_standard_regex_features(string cardTitle, string regex)
        {
            var heroCard = new HeroCard(title: cardTitle);

            var sut = new HeroCardAssertions(heroCard);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 7
0
        public void TitleMatching_should_pass_if_regex_exactly_matches_message_Title(string cardTitleAndRegex)
        {
            var heroCard = new HeroCard(title: cardTitleAndRegex);

            var sut = new HeroCardAssertions(heroCard);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 8
0
        public void TitleMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var card = new HeroCard();

            var sut = new HeroCardAssertions(card);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 9
0
        public void TitleMatching_should_throw_HeroCardAssertionFailedException_when_text_is_null()
        {
            var card = new HeroCard();

            var sut = new HeroCardAssertions(card);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
        }
Ejemplo n.º 10
0
        public void TitleMatching_should_throw_HeroCardAssertionFailedException_when_trying_to_capture_groups_but_text_is_null()
        {
            IList <string> matches;
            var            card = new HeroCard();

            var sut = new HeroCardAssertions(card);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
        }
Ejemplo n.º 11
0
        public void TitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text()
        {
            IList <string> matches;

            var heroCard = new HeroCard(title: "some text");

            var sut = new HeroCardAssertions(heroCard);

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

            matches.Should().BeNull();
        }
Ejemplo n.º 12
0
        public void TitleMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var card = new HeroCard();

            var sut = new HeroCardAssertions(card);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 13
0
        public void TextMatching_should_throw_ArgumentNullException_if_when_capturing_groups_regex_is_null()
        {
            IList <string> matches;

            var card = new HeroCard();

            var sut = new HeroCardAssertions(card);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 14
0
        public void TitleMatching_should_output_matches_when_groupMatchingRegex_matches_text()
        {
            IList <string> matches;

            const string someText = "some text";
            var          heroCard = new HeroCard(title: someText);

            var sut = new HeroCardAssertions(heroCard);

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

            matches.First().Should().Be(someText);
        }
Ejemplo n.º 15
0
        public void TitleMatching_should_not_output_matches_when_regex_does_not_match_text()
        {
            IList <string> matches = null;

            var heroCard = new HeroCard(title: "some text");

            var sut = new HeroCardAssertions(heroCard);

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

            act.ShouldThrow <HeroCardAssertionFailedException>();
            matches.Should().BeNull();
        }
Ejemplo n.º 16
0
        public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times()
        {
            IList <string> matches;

            const string someText = "some text";
            var          heroCard = new HeroCard(title: someText);

            var sut = new HeroCardAssertions(heroCard);

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

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

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