public async Task GetCustomer_ReturnsNotFoundCustomer() { using var context = new DataContext(ContextOptions); var customerId = 200; var customerService = FactoryService.CreateCustomerService(context); var customer = await customerService.GetCustomer(customerId); Assert.Null(customer); }
public async Task AddorUpdate_AddNewCustomer_ReturnsCustomer() { using var context = new DataContext(ContextOptions); var newCustomer = FactoryService.CreateCustomer(); var customerService = FactoryService.CreateCustomerService(context); var customer = await customerService.AddorUpdate(newCustomer); Assert.Equal("Customer Four", customer.Name); Assert.True(customer.Id > 0); }
public async Task GetCustomer_ReturnsFoundCustomer_WithoutAddress() { using var context = new DataContext(ContextOptions); var customerId = 2; var customerService = FactoryService.CreateCustomerService(context); var customer = await customerService.GetCustomer(customerId); Assert.Equal("Customer Two", customer.Name); Assert.NotNull(customer.Address); }