public static void SetSupplierSection_NullOrder_ThrowsException( Supplier supplier, Contact contact, SupplierSectionService service) { Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetSupplierSection(null, supplier, contact)); }
public static void SetSupplierSection_NullContact_ThrowsException( Order order, Supplier supplier, SupplierSectionService service) { Assert.ThrowsAsync <ArgumentNullException>(async() => await service.SetSupplierSection(order, supplier, null)); }
public static async Task GetOrder_ReturnsNull( CallOffId callOffId, SupplierSectionService service) { var result = await service.GetOrder(callOffId); result.Should().BeNull(); }
public static async Task GetOrder_ReturnsOrder( [Frozen] ApplicationDbContext context, Order order, SupplierSectionService service) { context.Order.Add(order); await context.SaveChangesAsync(); var result = await service.GetOrder(order.CallOffId); result.Should().BeEquivalentTo(order); }
public static async Task SetSupplierSection_UpdatesSupplierContact( [Frozen] ApplicationDbContext context, [Frozen] Contact contact, Order order, Supplier supplier, SupplierSectionService service) { context.Order.Add(order); context.Supplier.Add(supplier); await context.SaveChangesAsync(); var expected = order.SupplierContact; await service.SetSupplierSection(order, supplier, contact); expected.Should().Be(contact); }
public static async Task SetSupplierSection_SavesToDb( [Frozen] ApplicationDbContext context, [Frozen] Contact contact, Order order, Supplier supplier, SupplierSectionService service) { context.Order.Add(order); context.Supplier.Add(supplier); await context.SaveChangesAsync(); await service.SetSupplierSection(order, supplier, contact); var expectedOrder = context.Set <Order>().First(o => o.Equals(order)); expectedOrder.Supplier.Name.Should().Be(supplier.Name); expectedOrder.SupplierContact.Should().Be(contact); }
public static void Constructor_NullAccessor_ThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => _ = new SupplierSectionService(null)); }