示例#1
0
        public void TextMatching_should_throw_SigninCardAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var cards = SigninCardTestData.CreateRandomSigninCards();

            var sut = new SigninCardSetAssertions(cards);

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

            act.ShouldThrow <SigninCardAssertionFailedException>();
        }
示例#2
0
        public void TextMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var cards = SigninCardTestData.CreateRandomSigninCards();

            var sut = new SigninCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
示例#3
0
        public void TextMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var cards = SigninCardTestData.CreateRandomSigninCards();

            var sut = new SigninCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
示例#4
0
        public void TextMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Text_of_any_card()
        {
            IList <string> matches;

            var cards = SigninCardTestData.CreateRandomSigninCards();

            var sut = new SigninCardSetAssertions(cards);

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

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

            var cards = SigninCardTestData.CreateRandomSigninCards();

            var sut = new SigninCardSetAssertions(cards);

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

            act.ShouldThrow <SigninCardAssertionFailedException>();
            matches.Should().BeNull();
        }
示例#6
0
        public void Extracted_signin_cards_are_used_to_create_signin_card_set_assertions()
        {
            var signinCards = SigninCardTestData.CreateRandomSigninCards();

            _extractor.ExtractCards <SigninCard>(Arg.Any <IEnumerable <Activity> >()).Returns(signinCards);

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

            var result = sut.OfTypeSigninCard();

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

            assertions.SigninCards.ShouldBeEquivalentTo(signinCards);
        }
示例#7
0
        public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Text_on_multiple_cards()
        {
            IList <string> matches;

            var cards = SigninCardTestData.CreateRandomSigninCards();

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

            var sut = new SigninCardSetAssertions(cards);

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

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