예제 #1
0
        private async Task ShouldRemoveWebhook()
        {
            _apiClient.Setup(apiClient =>
                             apiClient.Delete <EmptyResponse>("webhooks/wh_kve4kqtq3ueezaxriev666j4ky", _authorization,
                                                              CancellationToken.None))
            .ReturnsAsync(() => new EmptyResponse());

            IWebhooksClient client = new WebhooksClient(_apiClient.Object, _configuration.Object);

            var response = await client.RemoveWebhook("wh_kve4kqtq3ueezaxriev666j4ky");

            response.ShouldNotBeNull();
        }
예제 #2
0
        private async Task ShouldRetrieveWebhook()
        {
            var webhookResponse = new WebhookResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Get <WebhookResponse>("webhooks/wh_kve4kqtq3ueezaxriev666j4ky", _authorization,
                                                             CancellationToken.None))
            .ReturnsAsync(() => webhookResponse);

            IWebhooksClient client = new WebhooksClient(_apiClient.Object, _configuration.Object);

            var response = await client.RetrieveWebhook("wh_kve4kqtq3ueezaxriev666j4ky");

            response.ShouldNotBeNull();
            response.ShouldBeSameAs(webhookResponse);
        }
예제 #3
0
        private async Task ShouldRetrieveWebhooks()
        {
            var webhookResponses = new ItemsResponse <WebhookResponse>();

            _apiClient.Setup(apiClient =>
                             apiClient.Get <ItemsResponse <WebhookResponse> >("webhooks", _authorization,
                                                                              CancellationToken.None))
            .ReturnsAsync(() => webhookResponses);

            IWebhooksClient client = new WebhooksClient(_apiClient.Object, _configuration.Object);

            var response = await client.RetrieveWebhooks();

            response.ShouldNotBeNull();
            response.ShouldBeSameAs(webhookResponses);
        }
예제 #4
0
        private async Task ShouldRegisterWebhook()
        {
            var webhookRequest  = new WebhookRequest();
            var webhookResponse = new WebhookResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <WebhookResponse>("webhooks", _authorization, webhookRequest,
                                                              CancellationToken.None, null))
            .ReturnsAsync(() => webhookResponse);

            IWebhooksClient client = new WebhooksClient(_apiClient.Object, _configuration.Object);

            var response = await client.RegisterWebhook(webhookRequest);

            response.ShouldNotBeNull();
            response.ShouldBe(webhookResponse);
        }