コード例 #1
0
        public void Attachment_should_return_ActivityAttachmentAssertions()
        {
            var activity = new Activity();

            var sut = new ActivityAssertions(activity);

            sut.WithAttachment().Should().BeAssignableTo <ActivityAttachmentAssertions>().And.NotBeNull();
        }
コード例 #2
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #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>();
        }
コード例 #4
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #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>();
        }
コード例 #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
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #8
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #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>();
        }
コード例 #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>();
        }
コード例 #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>();
        }
コード例 #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>();
        }
コード例 #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);
        }
コード例 #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>();
        }
コード例 #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();
        }
コード例 #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>();
        }
コード例 #17
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #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>();
        }
コード例 #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>();
        }
コード例 #22
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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();
        }
コード例 #23
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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>();
        }
コード例 #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>();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #27
0
            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>();
            }
コード例 #28
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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);
        }
コード例 #29
0
ファイル: For_from_matching.cs プロジェクト: jcme/BotSpec
        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();
        }
コード例 #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);
        }