public async Task TestSaveCustomer() { var orderContext = new OrdersContext(null); var newCustomerCommand = new CustomerUpdates.Command(Guid.Parse("c17a59df-0c7d-4f61-9bb9-e467861984a6"), "Alice", "Doyle1"); var commandHandler = new CustomerUpdates.CommandHandler(orderContext, null); var result = await commandHandler.Handle(newCustomerCommand, CancellationToken.None).ConfigureAwait(false); Assert.IsTrue(result.IsSuccess); }
public async Task TestMissingCustomerIDException() { var orderContext = new OrdersContext(null); var newCustomerCommand = new CustomerUpdates.Command(Guid.Empty, "Alice", "Doyle1"); var commandHandler = new CustomerUpdates.CommandHandler(orderContext, null); try { var result = await commandHandler.Handle(newCustomerCommand, CancellationToken.None).ConfigureAwait(false); Assert.Fail("No Exception thrown"); } catch (Exception ex) { Assert.IsTrue(ex is ArgumentNullException); } }