コード例 #1
0
        public void IdMatching_should_throw_ActivityAssertionFailedException_for_non_matching_regexes(string activityId, string regex)
        {
            var activity = new Activity(id: activityId);

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(regex);

            act.ShouldThrow <ActivityAssertionFailedException>();
        }
コード例 #2
0
        public void IdMatching_should_pass_regardless_of_case(string activityId, string regex)
        {
            var activity = new Activity(id: activityId);

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
コード例 #3
0
        public void IdMatching_should_pass_when_using_standard_regex_features(string activityId, string regex)
        {
            var activity = new Activity(id: activityId);

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
コード例 #4
0
        public void IdMatching_should_throw_ActivityAssertionFailedException_when_text_is_null()
        {
            var activity = new Activity();

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching("anything");

            act.ShouldThrow <ActivityAssertionFailedException>();
        }
コード例 #5
0
        public void IdMatching_should_pass_if_regex_exactly_matches_activity_Id(string activityIdAndRegex)
        {
            var activity = new Activity(id: activityIdAndRegex);

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(activityIdAndRegex);

            act.ShouldNotThrow <Exception>();
        }
コード例 #6
0
        public void IdMatching_should_throw_ArgumentNullException_when_regex_is_null()
        {
            var activity = new Activity(id: "valid text");

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(null);

            act.ShouldThrow <ArgumentNullException>();
        }
コード例 #7
0
        public void IdMatching_should_throw_ArgumentNullException_when_trying_to_capture_groups_but_regex_is_null()
        {
            IList <string> matches;
            var            activity = new Activity(id: "some text");

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(null, "(.*)", out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
コード例 #8
0
        public void IdMatching_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.IdMatching("anything", "(.*)", out matches);

            act.ShouldThrow <ActivityAssertionFailedException>();
        }
コード例 #9
0
        public void IdMatching_should_throw_ArgumentNullException_when_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var activity = new Activity(id: "valid text");

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching(".*", null, out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
コード例 #10
0
        public void IdMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text()
        {
            IList <string> matches;

            var activity = new Activity(id: "some text");

            var sut = new ActivityAssertions(activity);

            sut.IdMatching("some text", "(non matching)", out matches);

            matches.Should().BeNull();
        }
コード例 #11
0
        public void IdMatching_should_not_output_matches_when_regex_does_not_match_text()
        {
            IList <string> matches = null;

            var activity = new Activity(id: "some text");

            var sut = new ActivityAssertions(activity);

            Action act = () => sut.IdMatching("non matching regex", "(some text)", out matches);

            act.ShouldThrow <ActivityAssertionFailedException>();
            matches.Should().BeNull();
        }
コード例 #12
0
        public void IdMatching_should_output_matches_when_groupMatchingRegex_matches_text()
        {
            IList <string> matches;

            const string someId   = "some text";
            var          activity = new Activity(id: someId);

            var sut = new ActivityAssertions(activity);

            sut.IdMatching(someId, $"({someId})", out matches);

            matches.First().Should().Be(someId);
        }
コード例 #13
0
        public void IdMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times()
        {
            IList <string> matches;

            const string someId   = "some text";
            var          activity = new Activity(id: someId);

            var sut = new ActivityAssertions(activity);

            var match1 = "some";
            var match2 = "text";

            sut.IdMatching(someId, $"({match1}) ({match2})", out matches);

            matches.Should().Contain(match1, match2);
        }