public void TextMatching_should_throw_ActivityAssertionFailedException_for_non_matching_regexes(string activityText, string regex) { var activity = new Activity(text: activityText); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(regex); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void TextMatching_should_pass_regardless_of_case(string activityText, string regex) { var activity = new Activity(text: activityText); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TextMatching_should_pass_when_using_standard_regex_features(string activityText, string regex) { var activity = new Activity(text: activityText); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TextMatching_should_throw_ActivityAssertionFailedException_when_text_is_null() { var activity = new Activity(); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching("anything"); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void TextMatching_should_pass_if_regex_exactly_matches_activity_Text(string activityTextAndRegex) { var activity = new Activity(text: activityTextAndRegex); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(activityTextAndRegex); act.ShouldNotThrow <Exception>(); }
public void TextMatching_should_throw_ArgumentNullException_when_regex_is_null() { var activity = new Activity(text: "valid text"); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(null); act.ShouldThrow <ArgumentNullException>(); }
public void TextMatching_should_throw_ArgumentNullException_when_trying_to_capture_groups_but_regex_is_null() { IList <string> matches; var activity = new Activity(text: "some text"); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(null, "(.*)", out matches); act.ShouldThrow <ArgumentNullException>(); }
public void TextMatching_should_throw_ActivityAssertionFailedException_when_trying_to_capture_groups_but_text_is_null() { IList <string> matches; var activity = new Activity(); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching("anything", "(.*)", out matches); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void TextMatching_should_throw_ArgumentNullException_when_groupMatchRegex_is_null() { IList <string> matches; var activity = new Activity(text: "valid text"); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching(".*", null, out matches); act.ShouldThrow <ArgumentNullException>(); }
public void TextMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text() { IList <string> matches; var activity = new Activity(text: "some text"); var sut = new ActivityAssertions(activity); sut.TextMatching("some text", "(non matching)", out matches); matches.Should().BeNull(); }
public void TextMatching_should_not_output_matches_when_regex_does_not_match_text() { IList <string> matches = null; var activity = new Activity(text: "some text"); var sut = new ActivityAssertions(activity); Action act = () => sut.TextMatching("non matching regex", "(some text)", out matches); act.ShouldThrow <ActivityAssertionFailedException>(); matches.Should().BeNull(); }
public void TextMatching_should_output_matches_when_groupMatchingRegex_matches_text() { IList <string> matches; const string someText = "some text"; var activity = new Activity(text: someText); var sut = new ActivityAssertions(activity); sut.TextMatching(someText, $"({someText})", out matches); matches.First().Should().Be(someText); }
public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times() { IList <string> matches; const string someText = "some text"; var activity = new Activity(text: someText); var sut = new ActivityAssertions(activity); var match1 = "some"; var match2 = "text"; sut.TextMatching(someText, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }