public void TestUnitPriceWithBulkMoreThanRequired() { var item = new SaleItem('A', 1.00, Tuple.Create(6, 3.00)); var quantity = 7; var expectedPrice = 4.00; var actualPrice = item.PriceAtQuantity(quantity); Assert.AreEqual(expectedPrice, actualPrice, delta: expectedPrice / 100); }
public void TestUnitPriceNoBulkZeroQuantity() { var item = new SaleItem('A', 1.00); var quantity = 0; var expectedPrice = 0.00; var actualPrice = item.PriceAtQuantity(quantity); Assert.AreEqual(expectedPrice, actualPrice, delta: expectedPrice / 100); }
public void TestPriceUpdateWithBulk() { var item = new SaleItem('A', 1.00, Tuple.Create(6, 3.00)); item.UpdatePrice(1.00, Tuple.Create(3, 1.00)); var quantity = 7; var expectedPrice = 3.00; var actualPrice = item.PriceAtQuantity(quantity); Assert.AreEqual(expectedPrice, actualPrice, delta: expectedPrice / 100); }