Exemplo n.º 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>();
        }
Exemplo n.º 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>();
        }
Exemplo n.º 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>();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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");
        }