Exemplo n.º 1
0
        public void Attachment_should_return_ActivityAttachmentAssertions()
        {
            var activity = new Activity();

            var sut = new ActivityAssertions(activity);

            sut.WithAttachment().Should().BeAssignableTo <ActivityAttachmentAssertions>().And.NotBeNull();
        }
Exemplo n.º 2
0
        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>();
        }
Exemplo n.º 3
0
        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>();
        }
Exemplo n.º 4
0
        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>();
        }
Exemplo n.º 5
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>();
        }
Exemplo n.º 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>();
        }
Exemplo n.º 7
0
        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>();
        }
Exemplo n.º 8
0
        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>();
        }
Exemplo n.º 9
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>();
        }
Exemplo n.º 10
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>();
        }
Exemplo n.º 11
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>();
        }
Exemplo n.º 12
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>();
        }
Exemplo n.º 13
0
        public void Like_returns_same_object_for_fluent_chaining()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            var result = sut.ChannelIdLike($"^{activity.ChannelId}$");

            result.Should().Be(sut);
        }
Exemplo n.º 14
0
        public void Pattern_that_does_not_match_throws()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            Action act = () => sut.ChannelIdLike(".*NonMatchingPattern.*");

            act.ShouldThrowExactly <BotSpecException>();
        }
Exemplo n.º 15
0
        public void Exact_match_does_not_throw()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            Action act = () => sut.IdIs(activity.Id);

            act.ShouldNotThrow();
        }
Exemplo n.º 16
0
        public void Non_exact_match_throws()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            Action act = () => sut.ChannelIdIs("NonMatchingId");

            act.ShouldThrowExactly <BotSpecException>();
        }
Exemplo n.º 17
0
        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>();
        }
Exemplo n.º 18
0
        public void Is_returns_same_object_for_fluent_chaining()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            var result = sut.IdIs(activity.Id);

            result.Should().Be(sut);
        }
Exemplo n.º 19
0
        public void Pattern_match_does_not_throw()
        {
            var fixture  = new Fixture();
            var activity = fixture.Create <Activity>();

            var sut = new ActivityAssertions(activity, _settings);

            Action act = () => sut.ChannelIdLike(".*");

            act.ShouldNotThrow();
        }
Exemplo n.º 20
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>();
        }
Exemplo n.º 21
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>();
        }
Exemplo n.º 22
0
        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();
        }
Exemplo n.º 23
0
        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>();
        }
Exemplo n.º 24
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>();
        }
Exemplo n.º 25
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();
        }
Exemplo n.º 26
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();
        }
            public void Non_messages_throw_when_trying_to_convert_to_IMessageAssertions()
            {
                var fixture  = new Fixture();
                var activity = fixture.Create <Activity>();

                activity.Type = ActivityTypes.EndOfConversation;

                var sut = new ActivityAssertions(activity, _settings);

                Action act = () => sut.IsMessage();

                act.ShouldThrowExactly <BotSpecException>();
            }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        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();
        }
Exemplo n.º 30
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);
        }