public void FromMatching_should_pass_when_using_standard_regex_features(string activityFrom, string regex) { var activity = new Activity(fromProperty: new ChannelAccount(name: activityFrom)); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(regex); act.ShouldNotThrow <Exception>(); }
public void FromMatching_should_throw_ActivityAssertionFailedException_for_non_matching_regexes(string activityFrom, string regex) { var activity = new Activity(fromProperty: new ChannelAccount(name: activityFrom)); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(regex); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void FromMatching_should_throw_ActivityAssertionFailedException_when_text_is_null() { var activity = new Activity(); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching("anything"); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void FromMatching_should_pass_if_regex_exactly_matches_activity_From(string activityFromAndRegex) { var activity = new Activity(fromProperty: new ChannelAccount(name: activityFromAndRegex)); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(activityFromAndRegex); act.ShouldNotThrow <Exception>(); }
public void FromMatching_should_throw_ArgumentNullException_when_regex_is_null() { var activity = new Activity(fromProperty: new ChannelAccount(name: "valid text")); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(null); act.ShouldThrow <ArgumentNullException>(); }
public void FromMatching_should_throw_ArgumentNullException_when_trying_to_capture_groups_but_regex_is_null() { IList <string> matches; var activity = new Activity(fromProperty: new ChannelAccount(name: "some text")); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(null, "(.*)", out matches); act.ShouldThrow <ArgumentNullException>(); }
public void FromMatching_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.FromMatching("anything", "(.*)", out matches); act.ShouldThrow <ActivityAssertionFailedException>(); }
public void FromMatching_should_throw_ArgumentNullException_when_groupMatchRegex_is_null() { IList <string> matches; var activity = new Activity(fromProperty: new ChannelAccount(name: "valid text")); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching(".*", null, out matches); act.ShouldThrow <ArgumentNullException>(); }
public void FromMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text() { IList <string> matches; var activity = new Activity(fromProperty: new ChannelAccount(name: "some text")); var sut = new ActivityAssertions(activity); sut.FromMatching("some text", "(non matching)", out matches); matches.Should().BeNull(); }
public void FromMatching_should_not_output_matches_when_regex_does_not_match_text() { IList <string> matches = null; var activity = new Activity(fromProperty: new ChannelAccount(name: "some text")); var sut = new ActivityAssertions(activity); Action act = () => sut.FromMatching("non matching regex", "(some text)", out matches); act.ShouldThrow <ActivityAssertionFailedException>(); matches.Should().BeNull(); }
public void FromMatching_should_output_matches_when_groupMatchingRegex_matches_text() { IList <string> matches; const string someFrom = "some text"; var activity = new Activity(fromProperty: new ChannelAccount(name: someFrom)); var sut = new ActivityAssertions(activity); sut.FromMatching(someFrom, $"({someFrom})", out matches); matches.First().Should().Be(someFrom); }
public void FromMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times() { IList <string> matches; const string someFrom = "some text"; var activity = new Activity(fromProperty: new ChannelAccount(name: someFrom)); var sut = new ActivityAssertions(activity); var match1 = "some"; var match2 = "text"; sut.FromMatching(someFrom, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }