public void TitleMatching_should_throw_CardActionAssertionFailedException_when_regex_matches_no_cards(string regex) { var cardActions = CardActionTestData.CreateRandomCardActions(); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(regex); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void TitleMatching_should_throw_CardActionAssertionFailedException_when_Title_of_all_cards_is_null() { var cardActions = Enumerable.Range(1, 5).Select(_ => new CardAction()).ToList(); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(".*"); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void TitleMatching_should_pass_if_regex_exactly_matches_Title_of_at_least_1_card_regardless_of_case(string title, string regex) { var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(title: title); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TitleMatching_should_pass_when_using_standard_regex_features(string title, string regex) { var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(title: title); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TitleMatching_should_pass_if_regex_exactly_matches_message_Title_of_one_card(string cardTitleAndRegex) { var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(title: cardTitleAndRegex); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(cardTitleAndRegex); act.ShouldNotThrow <Exception>(); }
public void TitleMatching_should_throw_ArgumentNullException_if_regex_is_null() { var cardActions = CardActionTestData.CreateRandomCardActions(); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching(null); act.ShouldThrow <ArgumentNullException>(); }
public void TitleMatching_should_throw_CardActionAssertionFailedException_when_trying_to_capture_groups_but_Title_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.TitleMatching(".*", "(.*)", out matches); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void TitleMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null() { IList <string> matches; var cardActions = CardActionTestData.CreateRandomCardActions(); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching("(.*)", null, out matches); act.ShouldThrow <ArgumentNullException>(); }
public void TitleMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Title_of_any_card() { IList <string> matches; var cardActions = CardActionTestData.CreateRandomCardActions(); var sut = new CardActionSetAssertions(cardActions); sut.TitleMatching(".*", "(non matching)", out matches); matches.Should().BeNull(); }
public void TitleMatching_should_not_output_matches_when_regex_does_not_match_Title_of_any_cards() { IList <string> matches = null; var cardActions = CardActionTestData.CreateRandomCardActions(); var sut = new CardActionSetAssertions(cardActions); Action act = () => sut.TitleMatching("non matching regex", "(some text)", out matches); act.ShouldThrow <CardActionAssertionFailedException>(); matches.Should().BeNull(); }
public void TitleMatching_should_output_matches_when_groupMatchingRegex_matches_Title_of_any_card() { IList <string> matches; const string someTitle = "some text"; var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(title: someTitle); var sut = new CardActionSetAssertions(cardActions); sut.TitleMatching(someTitle, $"({someTitle})", out matches); matches.First().Should().Be(someTitle); }
public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Title_on_multiple_cards() { IList <string> matches; var cardActions = CardActionTestData.CreateRandomCardActions(); cardActions.Add(new CardAction(title: "some text")); cardActions.Add(new CardAction(title: "same text")); var sut = new CardActionSetAssertions(cardActions); sut.TitleMatching(".*", @"(s[oa]me) (text)", out matches); matches.Should().Contain("some", "same", "text"); }
public void TitleMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Title_several_times_for_a_single_card() { IList <string> matches; const string someTitle = "some text"; var cardActions = CardActionTestData.CreateCardActionSetWithOneActionThatHasSetProperties(title: someTitle); var sut = new CardActionSetAssertions(cardActions); const string match1 = "some"; const string match2 = "text"; sut.TitleMatching(someTitle, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }