Esempio n. 1
0
        public void TextMatching_should_not_output_matches_when_regex_does_not_match_Text_of_any_activities()
        {
            IList <string> matches = null;

            var activities = ActivityTestData.CreateRandomActivities();

            var sut = new ActivitySetAssertions(activities);

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

            act.ShouldThrow <ActivityAssertionFailedException>();
            matches.Should().BeNull();
        }
Esempio n. 2
0
        public void TextMatching_should_output_matches_when_groupMatchingRegex_matches_Text_of_any_activity()
        {
            IList <string> matches;

            const string someText   = "some text";
            var          activities = ActivityTestData.CreateActivitySetWithOneActivityThatHasSetProperties(text: someText);

            var sut = new ActivitySetAssertions(activities);

            sut.TextMatching(someText, $"({someText})", out matches);

            matches.First().Should().Be(someText);
        }
Esempio n. 3
0
        public void FromMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_From_on_multiple_activities()
        {
            IList <string> matches;

            var activities = ActivityTestData.CreateRandomActivities();

            activities.Add(new Activity(fromProperty: new ChannelAccount(name: "some text")));
            activities.Add(new Activity(fromProperty: new ChannelAccount(name: "same text")));

            var sut = new ActivitySetAssertions(activities);

            sut.FromMatching(".*", @"(s[oa]me) (text)", out matches);

            matches.Should().Contain("some", "same", "text");
        }
Esempio n. 4
0
        public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Text_on_multiple_activities()
        {
            IList <string> matches;

            var activities = ActivityTestData.CreateRandomActivities();

            activities.Add(new Activity(text: "some text"));
            activities.Add(new Activity(text: "same text"));

            var sut = new ActivitySetAssertions(activities);

            sut.TextMatching(".*", @"(s[oa]me) (text)", out matches);

            matches.Should().Contain("some", "same", "text");
        }
Esempio n. 5
0
        public void FromMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_From_several_times_for_a_single_activity()
        {
            IList <string> matches;

            const string someFrom   = "some text";
            var          activities = ActivityTestData.CreateActivitySetWithOneActivityThatHasSetProperties(fromProperty: someFrom);

            var sut = new ActivitySetAssertions(activities);

            const string match1 = "some";
            const string match2 = "text";

            sut.FromMatching(someFrom, $"({match1}) ({match2})", out matches);

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