public async Task CreateNewCustomerRecurringPaymentAsync_Result_Has_Ids_Populated() { // Arrange var customerRecurringPayment = new NewCustomerRecurringPayment <Ach> { Customer = new Customer(), Account = new Ach(), RecurringPayment = new RecurringPayment() }; accountService.Setup(m => m.CreateAccountAsync <Ach>(It.IsAny <Ach>())).ReturnsAsync(new Ach { Id = 1 }); webServiceRequest.Setup(m => m.PostDeserializedAsync <RecurringPayment, Result <RecurringPayment> >(It.IsAny <Uri>(), It.IsAny <RecurringPayment>())).ReturnsAsync(new Result <RecurringPayment> { Response = new RecurringPayment { Id = 1 } }); // Act var result = await service.CreateNewCustomerRecurringPaymentAsync(customerRecurringPayment); // Assert Assert.Equal(1, result.Customer.Id); Assert.Equal(1, result.Account.Id); Assert.Equal(1, result.RecurringPayment.Id); }
public async Task CreateNewCustomerRecurringPaymentAsync_Verify_CustomerService_CreateCustomerAsync() { // Arrange var customerRecurringPayment = new NewCustomerRecurringPayment <Ach> { Customer = new Customer(), Account = new Ach(), RecurringPayment = new RecurringPayment() }; accountService.Setup(m => m.CreateAccountAsync <Ach>(It.IsAny <Ach>())).ReturnsAsync(new Ach { Id = 1 }); webServiceRequest.Setup(m => m.PostDeserializedAsync <RecurringPayment, Result <RecurringPayment> >(It.IsAny <Uri>(), It.IsAny <RecurringPayment>())).ReturnsAsync(new Result <RecurringPayment> { Response = new RecurringPayment { Id = 1 } }); // Act await service.CreateNewCustomerRecurringPaymentAsync(customerRecurringPayment); // Assert customerService.Verify(m => m.CreateCustomerAsync(It.IsAny <Customer>())); }
public async Task <NewCustomerRecurringPayment <T> > CreateNewCustomerRecurringPaymentAsync <T>(NewCustomerRecurringPayment <T> customerRecurringPayment) where T : Account, new() { try { var result = await paymentScheduleService.CreateNewCustomerRecurringPaymentAsync <T>(customerRecurringPayment); if (result != null) { DumpObject("CreateNewCustomerRecurringPaymentAsync", result); } return(result); } catch (PaySimpleException ex) { DumpObject("PaySimpleException", ex.ValidationErrors); } catch (PaySimpleEndpointException ex) { DumpObject("PaySimpleEndpointException", ex.EndpointErrors); } return(null); }