public async Task TestCrudOperationsAsync() { // Create the first customer var customer = await _client.CreateCustomerAsync(null, CUSTOMER1); AssertCustomers(CUSTOMER1, customer); // Create the second customer customer = await _client.CreateCustomerAsync(null, CUSTOMER2); AssertCustomers(CUSTOMER2, customer); // Get all customers var page = await _client.GetCustomersAsync( null, new FilterParams(), new PagingParams(), new SortParams() ); Assert.NotNull(page); Assert.Equal(2, page.Data.Count); var customer1 = page.Data[0]; // Update the customer customer1.FirstName = "ABC"; customer = await _client.UpdateCustomerAsync(null, customer1); Assert.NotNull(customer); Assert.Equal(customer1.Id, customer.Id); Assert.Equal("ABC", customer.FirstName); // Delete the customer customer = await _client.DeleteCustomerByIdAsync(null, customer1.Id); Assert.NotNull(customer); Assert.Equal(customer1.Id, customer.Id); // Try to get deleted customer customer = await _client.GetCustomerByIdAsync(null, customer1.Id); Assert.Null(customer); // Clean up for the second test await _client.DeleteCustomerByIdAsync(null, CUSTOMER2.Id); }
public async Task <CustomerV1> DeleteCustomerByIdAsync(string correlationId, string id) { if (_customersClient == null) { return(null); } return(await _customersClient.DeleteCustomerByIdAsync(correlationId, id)); }