public void TestMethod_Only_ItemD()

        {
            //Arrange

            IPromotion promotion = null;

            promotion = new Promotion1();

            PromotionResult promotionResult = new PromotionResult(promotion);

            promotionResult.Items.Add(new ItemD()

            {
                NoOfItems = 1,

                Cost = 15
            });

            //Act

            var result = promotionResult.Calculate();

            //Assert

            Assert.AreEqual <double>(result, 15);
        }
Esempio n. 2
0
        public void Promotion1()
        {
            var promotion1 = new Promotion1();
            var result     = promotion1.CalculatePromotion(skuToOrder);

            Assert.Equal(expectedskuToOrder[0].Price, result[0].Price);
        }
        public void TestMethod_ScenarioD()

        {
            //Arrange

            IPromotion promotion = null;

            promotion = new Promotion1();

            PromotionResult promotionResult = new PromotionResult(promotion);

            promotionResult.Items.Add(new ItemA()

            {
                NoOfItems = 3,

                Cost = 50
            });

            promotionResult.Items.Add(new ItemB()

            {
                NoOfItems = 5,

                Cost = 30
            });

            promotionResult.Items.Add(new ItemC()

            {
                NoOfItems = 1,

                Cost = 20
            });

            promotionResult.Items.Add(new ItemD()

            {
                NoOfItems = 1,

                Cost = 15
            });

            //Act

            var result = promotionResult.Calculate();

            //Assert

            Assert.AreEqual <double>(result, 280);
        }