Exemplo n.º 1
0
        public void OrderFreeDeliveryAndDiscountsTest()
        {
            var b1 = new PaperBook()
            {
                Title = "b1", Price = 200, Qty = 7
            };
            var b2 = new PaperBook()
            {
                Title = "b2", Price = 100
            };
            var b3 = new DigitalBook()
            {
                Title = "b3", Price = 400
            };

            var promos = new List <IPromo>()
            {
                new DiscountPercent(10, CostPromoPriority.Medium),
                new DiscountCurrency(200, CostPromoPriority.High),
            };

            var cart = new ShoppingCart(new CartTotalsCalculator());

            cart.Add(b1);
            cart.Add(b2);
            cart.Add(b3);
            cart.AddRange(promos);
            Assert.Equal(1530, cart.GetTotal());
        }
Exemplo n.º 2
0
        public void OrderFreeDeliveryTest()
        {
            var b1 = new PaperBook()
            {
                Title = "b1", Price = 200, Qty = 7
            };
            var b2 = new PaperBook()
            {
                Title = "b2", Price = 100
            };
            var b3 = new DigitalBook()
            {
                Title = "b3", Price = 400
            };

            var cart = new ShoppingCart(new CartTotalsCalculator());

            cart.Add(b1);
            cart.Add(b2);
            cart.Add(b3);
            Assert.Equal(1900, cart.GetTotal());
        }