Пример #1
0
            public void ShouldThrowIfChannelIdIsMissingFromChannelCreateMessageRequest(
                Request request,
                [Target] DefaultUrlBuilder builder
                )
            {
                request.Endpoint = ChannelEndpoint.CreateMessage;

                Action func = () => builder.BuildFromRequest(request);

                func.Should().Throw <MissingParameterException>()
                .And.Parameter.Should().Be("channel.id");
            }
Пример #2
0
            public void ShouldThrowIfGivenAnUnhandledEndpoint(
                Request request,
                [Target] DefaultUrlBuilder builder
                )
            {
                var endpoint = (ChannelEndpoint)9999999;

                request.Endpoint = endpoint;

                Action func = () => builder.BuildFromRequest(request);

                func.Should().Throw <UnhandledEndpointException>()
                .And.Endpoint.Should().Be((Endpoint)endpoint);
            }
Пример #3
0
            public void ShouldBuildChannelCreateMessageEndpoints(
                string channelId,
                Request request,
                Uri baseUrl,
                [Frozen] RequestOptions options,
                [Target] DefaultUrlBuilder builder
                )
            {
                request.Endpoint = ChannelEndpoint.CreateMessage;
                request.Parameters["channel.id"] = channelId;

                var result = builder.BuildFromRequest(request);

                result.Should().Be($"{options.InvokeBaseUrl}/channels/{channelId}/messages");
            }