Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }