Beispiel #1
0
            public async Task List_ShouldCallTheCorrectUrl()
            {
                AblyRequest request = null;
                var         rest    = GetRestClient(r =>
                {
                    request = r;
                    return(Task.FromResult(new AblyResponse()
                    {
                        TextResponse = "[]"
                    }));
                });

                await rest.Push.Admin.ChannelSubscriptions.ListAsync(ListSubscriptionsRequest.Empty());

                request.Url.Should().Be("/push/channelSubscriptions");
                request.Method.Should().Be(HttpMethod.Get);
            }
Beispiel #2
0
            public async Task List_ShouldPassTheCorrectFilters()
            {
                async Task <AblyRequest> CallList(ListSubscriptionsRequest filter)
                {
                    AblyRequest request = null;
                    var         rest    = GetRestClient(r =>
                    {
                        request = r;
                        return(Task.FromResult(new AblyResponse()
                        {
                            TextResponse = "[]"
                        }));
                    });
                    await rest.Push.Admin.ChannelSubscriptions.ListAsync(filter);

                    return(request);
                }

                var emptyFilterRequest = await CallList(ListSubscriptionsRequest.Empty(100));

                emptyFilterRequest.QueryParameters.Should().ContainKey("limit").WhoseValue.Should().Be("100");

                var channelDeviceIdRequest =
                    await CallList(ListSubscriptionsRequest.WithDeviceId("test-channel", "device123"));

                channelDeviceIdRequest.QueryParameters.Should().ContainKey("channel")
                .WhoseValue.Should().Be("test-channel");
                channelDeviceIdRequest.QueryParameters.Should().ContainKey("deviceId")
                .WhoseValue.Should().Be("device123");

                var channelClientIdRequest =
                    await CallList(ListSubscriptionsRequest.WithClientId("test-channel", "clientId123"));

                channelClientIdRequest.QueryParameters.Should().ContainKey("channel")
                .WhoseValue.Should().Be("test-channel");
                channelClientIdRequest.QueryParameters.Should().ContainKey("clientId")
                .WhoseValue.Should().Be("clientId123");
            }