Exemplo n.º 1
0
        public void Promotion_Is_Not_Applied_When_Products_Has_Invalid_CartItem()
        {
            int expected = 0;
            IPromotionEngine <List <char> > promotionEngine = new PromotionEngine.PromotionEngine();
            ICartEngine <List <char> >      cartEngine      = new CartEngine();

            Billing billing = new Billing(promotionEngine, cartEngine);

            List <char> orderedProducts = new List <char>
            {
                'Z'
            };

            int actual = billing.CalculateTotalPrice(orderedProducts);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void Promotion_Is_Not_Applied_On_Products()
        {
            int expected = 100;
            IPromotionEngine <List <char> > promotionEngine = new PromotionEngine.PromotionEngine();
            ICartEngine <List <char> >      cartEngine      = new CartEngine();

            Billing billing = new Billing(promotionEngine, cartEngine);

            List <char> orderedProducts = new List <char>
            {
                'A',
                'B',
                'C'
            };

            int actual = billing.CalculateTotalPrice(orderedProducts);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void Promotion1_only_Applied_On_Products_Eventhough_Multiple_Promotions_Are_Valid()
        {
            int expected = 195;
            IPromotionEngine <List <char> > promotionEngine = new PromotionEngine.PromotionEngine();
            ICartEngine <List <char> >      cartEngine      = new CartEngine();

            Billing billing = new Billing(promotionEngine, cartEngine);

            List <char> orderedProducts = new List <char>
            {
                'A',
                'A',
                'A',
                'B',
                'C',
                'D'
            };

            int actual = billing.CalculateTotalPrice(orderedProducts);

            Assert.AreEqual(expected, actual);
        }