public async Task TryToRemoveACustomerThatDoesntExists() { // Retrieve DbContext var context = ApplicationDbContextInMemory.Get(); var handler = new CustomerRemoveEventHandler(context); // Set test customer var testCustomerId = 999999999; // Retrieve from database await handler.Handle(new CustomerRemoveCommand { CustomerId = testCustomerId }, new CancellationToken()); }
public async Task TryToRemoveACustomer() { // Retrieve DbContext var context = ApplicationDbContextInMemory.Get(); var handler = new CustomerRemoveEventHandler(context); // Get test customer var testCustomerId = GetTestCustomerId(context); // Retrieve from database await handler.Handle(new CustomerRemoveCommand { CustomerId = testCustomerId }, new CancellationToken()); var entry = context.Customers.SingleOrDefault(x => x.CustomerId == testCustomerId); // Check Assert.IsNull(entry); }