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(); }
public void TextMatching_should_output_matches_when_groupMatchingRegex_matches_Text_of_any_card() { IList <string> matches; const string someText = "some text"; var cards = SigninCardTestData.CreateSigninCardSetWithOneCardThatHasSetProperties(text: someText); var sut = new SigninCardSetAssertions(cards); sut.TextMatching(someText, $"({someText})", out matches); matches.First().Should().Be(someText); }
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); }
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"); }
public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Text_several_times_for_a_single_card() { IList <string> matches; const string someText = "some text"; var cards = SigninCardTestData.CreateSigninCardSetWithOneCardThatHasSetProperties(text: someText); var sut = new SigninCardSetAssertions(cards); const string match1 = "some"; const string match2 = "text"; sut.TextMatching(someText, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }