public void GivenOpenOrder_WhenAddingItemsThatExceedMaxOrderValue_ShouldFail() { // Arrange var order = new SalesOrder(); order.Open(new SalesOrderId(1), new CustomerId(2), new Address("1 Arnold Lane", "Elsewhere", new PostalCode("EL12", "1YY")), (decimal)7.5); // Act order.AddItems(3, new ProductId(3), (decimal)2.5); // Assert Assert.Throws <InvalidOperationException>(() => order.AddItems(1, new ProductId(3), (decimal)2.5)); }
public void GivenOpenOrder_WhenAddingItems_ShouldSucceed() { // Arrange var order = new SalesOrder(); order.Open(new SalesOrderId(1), new CustomerId(2), new Address("1 Arnold Lane", "Elsewhere", new PostalCode("EL12", "1YY")), (decimal)7.5); // Act order.AddItems(3, new ProductId(3), (decimal)2.5); // Assert Assert.AreEqual((decimal)7.5, order.TotalValue); }