public void _01_can_save_new_customer() { IInquiryCustomer customer = _customerBusinessLogic.GetCustomer(new InquiryCriteria { CustomerId = 1, Email = "*****@*****.**" }).Result; if (customer == null) { customer = new InquiryCustomer { Id = 1, Name = "Firstname Lastname", Email = "*****@*****.**", MobileNumber = "0123456789" }; customer.Transactions.Add(CreateTransaction(1, 1234.56, "USD", TransactionStatus.Success)); customer.Transactions.Add(CreateTransaction(1, 6543.21, "GBP", TransactionStatus.Canceled)); customer.Transactions.Add(CreateTransaction(1, 1111.22, "USD", TransactionStatus.Failed)); customer.Transactions.Add(CreateTransaction(1, 2222.23, "EUR", TransactionStatus.Success)); customer.Transactions.Add(CreateTransaction(1, 3333.34, "THB", TransactionStatus.Canceled)); customer.Transactions.Add(CreateTransaction(1, 7890.12, "USD", TransactionStatus.Failed)); _customerBusinessLogic.Save(customer).Wait(); } Assert.IsNotNull(customer); Assert.IsNotNull(customer.Transactions); }
public async void Delete(long internalId) { using (var context = new CustomerInquiryContext()) { var customer = new InquiryCustomer { Id = internalId }; context.Customers.Attach(customer); context.Customers.Remove(customer); await context.SaveChangesAsync(); } }