public async Task CanUpdateCustomer() { // If: We retrieve the customer list var response = await CustomerClient.GetCustomerListAsync(); if (response.Items.Count == 0) { Assert.Empty(response.Items); //No customers found. Unable to test deleting customers return; } // When: We update one of the customers in the list var customerIdToUpdate = response.Items.First().Id; var newCustomerName = DateTime.Now.ToShortTimeString(); var updateParameters = new CustomerRequest() { Name = newCustomerName }; var result = await CustomerClient.UpdateCustomerAsync(customerIdToUpdate, updateParameters); // Then: Make sure the new name is updated Assert.NotNull(result); Assert.Equal(newCustomerName, result.Name); }
public async Task CanUpdateCustomer() { // If: We retrieve the customer list ListResponse <CustomerResponse> response = await CustomerClient.GetCustomerListAsync(); if (response.Items.Count == 0) { Assert.Inconclusive("No customers found. Unable to test updating customers"); } // When: We update one of the customers in the list string customerIdToUpdate = response.Items.First().Id; string newCustomerName = DateTime.Now.ToShortTimeString(); CustomerRequest updateParameters = new CustomerRequest() { Name = newCustomerName }; CustomerResponse result = await CustomerClient.UpdateCustomerAsync(customerIdToUpdate, updateParameters); // Then: Make sure the new name is updated Assert.IsNotNull(result); Assert.AreEqual(newCustomerName, result.Name); }
public async Task <ResponseBase <bool> > UpdateCustomer(CustomerModel data) { var response = new ResponseBase <bool>(); var service = new CustomerClient(); try { var callback = await service.UpdateCustomerAsync(new CustomerContract() { Id = data.Id, Name = data.Name, Address = data.Address, BirthDate = data.BirthDate, CityId = data.CityId, CityName = data.CityName, CountryId = data.CountryId, CountryName = data.CountryName, DepartmentId = data.DepartmentId, DepartmentName = data.DepartmentName, DocumentId = data.DocumentId, DocumentType = data.DocumentType, DocumentTypeName = data.DocumentTypeName, }); response.Code = callback.Code; response.Data = callback.Data; response.Message = callback.Message; } catch (Exception ex) { response.Code = StatusCode.ServiceUnavailable; response.Message = $"Ups! no se pudo crear el usuario: {ex.Message}"; } service.Close(); return(response); }