Exemple #1
0
        private async Task ShouldGetCustomer()
        {
            _apiClient.Setup(apiClient =>
                             apiClient.Get <CustomerDetailsResponse>("customers/cus_12345", _authorization,
                                                                     CancellationToken.None))
            .ReturnsAsync(() => new CustomerDetailsResponse());
            ICustomersClient client = new CustomersClient(_apiClient.Object, _configuration.Object);

            var response = await client.Get("cus_12345", CancellationToken.None);

            response.ShouldNotBeNull();
        }
Exemple #2
0
        private async Task ShouldUpdateCustomer()
        {
            var customerRequest = new CustomerRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Patch <EmptyResponse>("customers/cus_12345", _authorization, customerRequest,
                                                             CancellationToken.None
                                                             , null))
            .ReturnsAsync(() => new EmptyResponse());

            ICustomersClient client = new CustomersClient(_apiClient.Object, _configuration.Object);

            var response = await client.Update("cus_12345", customerRequest, CancellationToken.None);

            response.ShouldNotBeNull();
        }
Exemple #3
0
        private async Task ShouldCreateCustomer()
        {
            var customerRequest = new CustomerRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <IdResponse>("customers", _authorization, customerRequest,
                                                         CancellationToken.None
                                                         , null))
            .ReturnsAsync(() => new IdResponse());

            ICustomersClient client = new CustomersClient(_apiClient.Object, _configuration.Object);

            var response = await client.Create(customerRequest, CancellationToken.None);

            response.ShouldNotBeNull();
        }