Example #1
0
        public void Test_CalculateTotal_WHEN_SingleSKUPromotionsApplyTo1Item_THEN_TotalIsAdjusted()
        {
            var orderItems = new IOrderItem[]
            {
                GetSKUOrderItem(PromotionEngineTestContext.Products.A, 5)
            };

            var target = new OrderTotalCalculatorTestBuilder().Build();
            var result = target.CalculateTotal(orderItems, PromotionEngineTestContext.ActivePromotions);

            Assert.AreEqual(230, result);
        }
Example #2
0
        public void Test_CalculateTotal_WHEN_NoPromotionsApply_THEN_TotalIsUnaffected()
        {
            // scenario A
            var orderItems = new IOrderItem[]
            {
                GetSKUOrderItem(PromotionEngineTestContext.Products.A, 1),
                GetSKUOrderItem(PromotionEngineTestContext.Products.B, 1),
                GetSKUOrderItem(PromotionEngineTestContext.Products.C, 1)
            };

            var target = new OrderTotalCalculatorTestBuilder().Build();
            var result = target.CalculateTotal(orderItems, PromotionEngineTestContext.ActivePromotions);

            Assert.AreEqual(100, result);
        }
Example #3
0
        public void Test_CalculateTotal_WHEN_SingleAndCombinationSKUPromotionsApply_THEN_TotalIsAdjusted()
        {
            //scenario C
            var orderItems = new IOrderItem[]
            {
                GetSKUOrderItem(PromotionEngineTestContext.Products.A, 3),
                GetSKUOrderItem(PromotionEngineTestContext.Products.B, 5),
                GetSKUOrderItem(PromotionEngineTestContext.Products.C, 1),
                GetSKUOrderItem(PromotionEngineTestContext.Products.D, 1)
            };

            var target = new OrderTotalCalculatorTestBuilder().Build();
            var result = target.CalculateTotal(orderItems, PromotionEngineTestContext.ActivePromotions);

            Assert.AreEqual(280, result);
        }