Esempio n. 1
0
        public void ImageMatching_should_pass_if_regex_exactly_matches_Image_of_at_least_1_card_regardless_of_case(string image, string regex)
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(image: image);

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldNotThrow <Exception>();
        }
Esempio n. 2
0
        public void TypeMatching_should_not_throw_when_card_action_type_matches_expected_type()
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(type: CallTypeString);

            var sut = new CardActionSetAssertions(cardActions);

            Action act = () => sut.ActionType(CallType);

            act.ShouldNotThrow <Exception>();
        }
Esempio n. 3
0
        public void TypeMatching_should_throw_CardActionAssertionSetFailedException_when_no_card_action_matches()
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithAllActionsWithSetProperties(type: CallTypeString);

            var sut = new CardActionSetAssertions(cardActions);

            Action act = () => sut.ActionType(CardActionType.DownloadFile);

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Esempio n. 4
0
        public void TypeMatching_should_throw_CardActionAssertionFailedException_when_type_of_all_card_actions_is_null()
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithAllActionsWithSetProperties(type: null);

            var sut = new CardActionSetAssertions(cardActions);

            Action act = () => sut.ActionType(CardActionType.Call);

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Esempio n. 5
0
        public void ImageMatching_should_throw_CardActionAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Esempio n. 6
0
        public void ImageMatching_should_throw_CardActionAssertionFailedException_when_Image_of_all_cards_is_null()
        {
            var cardActions = Enumerable.Range(1, 5).Select(_ => new CardAction()).ToList();

            var sut = new CardActionSetAssertions(cardActions);

            Action act = () => sut.ImageMatching(".*");

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Esempio n. 7
0
        public void ImageMatching_should_pass_if_regex_exactly_matches_message_Image_of_one_card(string cardImageAndRegex)
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(image: cardImageAndRegex);

            var sut = new CardActionSetAssertions(cardActions);

            Action act = () => sut.ImageMatching(cardImageAndRegex);

            act.ShouldNotThrow <Exception>();
        }
Esempio n. 8
0
        public void ImageMatching_should_pass_when_using_standard_regex_features(string image, string regex)
        {
            var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(image: image);

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldNotThrow <Exception>();
        }
Esempio n. 9
0
        public void ImageMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Esempio n. 10
0
        public void ImageMatching_should_throw_ArgumentNullException_if_regex_is_null_when_matching_groups()
        {
            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

            IList <string> matches;
            Action         act = () => sut.ImageMatching(null, "(.*)", out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
Esempio n. 11
0
        public void ImageMatching_should_throw_CardActionAssertionFailedException_when_trying_to_capture_groups_but_Image_of_all_cards_is_null()
        {
            IList <string> matches;

            var cardActions = Enumerable.Range(1, 5).Select(_ => new CardAction()).ToList();

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldThrow <CardActionAssertionFailedException>();
        }
Esempio n. 12
0
        public void ValueMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Esempio n. 13
0
        public void ImageMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Image_of_any_card()
        {
            IList <string> matches;

            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

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

            matches.Should().BeNull();
        }
        public void Only_non_null_CardActions_should_be_available_for_assertion()
        {
            var nonNullCardActions = CardActionTestData.CreateRandomCardActions();
            var inputList          = new List <CardAction> {
                null
            };

            inputList.AddRange(nonNullCardActions);

            var sut = new CardActionSetAssertions(inputList);

            sut.CardActions.ShouldBeEquivalentTo(nonNullCardActions);
        }
Esempio n. 15
0
        public void ImageMatching_should_not_output_matches_when_regex_does_not_match_Image_of_any_cards()
        {
            IList <string> matches = null;

            var cardActions = CardActionTestData.CreateRandomCardActions();

            var sut = new CardActionSetAssertions(cardActions);

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

            act.ShouldThrow <CardActionAssertionFailedException>();
            matches.Should().BeNull();
        }
Esempio n. 16
0
        public void ImageMatching_should_output_matches_when_groupMatchingRegex_matches_Image_of_any_card()
        {
            IList <string> matches;

            const string someImage   = "some text";
            var          cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(image: someImage);

            var sut = new CardActionSetAssertions(cardActions);

            sut.ImageMatching(someImage, $"({someImage})", out matches);

            matches.First().Should().Be(someImage);
        }
Esempio n. 17
0
        public void ImageMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Image_on_multiple_cards()
        {
            IList <string> matches;

            var cardActions = CardActionTestData.CreateRandomCardActions();

            cardActions.Add(new CardAction(image: "some text"));
            cardActions.Add(new CardAction(image: "same text"));

            var sut = new CardActionSetAssertions(cardActions);

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

            matches.Should().Contain("some", "same", "text");
        }
Esempio n. 18
0
        public void ImageMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Image_several_times_for_a_single_card()
        {
            IList <string> matches;

            const string someImage   = "some text";
            var          cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(image: someImage);

            var sut = new CardActionSetAssertions(cardActions);

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

            sut.ImageMatching(someImage, $"({match1}) ({match2})", out matches);

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