Example #1
0
            public void Aredpencilpromotionlasts30daysasthemaximumlength_PromotionActive50Days()
            {
                var p = GivenProductIsPromoted();

                Time.GoForwardInDays(50);
                Promoter.SetPromotion(p);
                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #2
0
            public void PriceReducedbyLess5Percent_PromoNotActive()
            {
                Product p = new Product(100);

                p.Price = 99;
                Time.GoForwardInDays(40);
                Promoter.SetPromotion(p);

                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #3
0
            public void PriceLess30Percent_PromoActive()
            {
                Product p = new Product(100);

                p.Price = 80;
                Time.GoForwardInDays(40);
                Promoter.SetPromotion(p);

                Assert.IsTrue(p.IsRedPencilPromoted);
            }
Example #4
0
            public void PriceReducedMoreThan40Percent_PromoActive()
            {
                Product p = new Product(100);

                p.Price = 50;
                Time.GoForwardInDays(40);
                Promoter.SetPromotion(p);

                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #5
0
            public void PreviousPriceNeedsToBeStableMoreThan30Days_PromoNOTActive()
            {
                Product p = new Product(100);

                p.Price = 80;
                Time.GoForwardInDays(10);
                Promoter.SetPromotion(p);

                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #6
0
            private static Product GivenProductIsPromoted()
            {
                Product p = new Product(100);

                p.Price = 80;
                Time.GoForwardInDays(40);
                Promoter.SetPromotion(p);

                // Should assertion be here??
                Assert.IsTrue(p.IsRedPencilPromoted);
                return(p);
            }
Example #7
0
            public void Duringtheredpencilpromotionsothattheoverallreductionismorethan30Percent_STOPPromotion()
            {
                // If the price if reduced during the red pencil promotion so that the overall reduction is more than 30% with regard to the original price, the promotion is ended immediately.
                var p = GivenProductIsPromoted();

                Time.GoForwardInDays(1);
                p.Price = 1;

                Promoter.SetPromotion(p);

                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #8
0
            public void ActivePromotion_NoPriceChange()
            {
                // If the price is increased during the red pencil promotion the promotion will be ended immediately.
                var p = GivenProductIsPromoted();

                Time.GoForwardInDays(1);
                p.Price = p.Price;

                Promoter.SetPromotion(p);

                Assert.IsTrue(p.IsRedPencilPromoted);
            }
Example #9
0
            public void Ifthepriceisincreasedduringtheredpencilpromotionthepromotionwillbeendedimmediately_()
            {
                // If the price is increased during the red pencil promotion the promotion will be ended immediately.
                var p = GivenProductIsPromoted();

                Time.GoForwardInDays(1);
                p.Price = 10000;

                Promoter.SetPromotion(p);

                Assert.IsFalse(p.IsRedPencilPromoted);
            }
Example #10
0
            public void Ifthepriceisfurtherreducedduringtheredpencilpromotionthepromotionwillnotbeprolongedbythatreduction_PromotionActive()
            {
                //If the price is further reduced during the red pencil promotion the promotion will not be prolonged by that reduction.
                var p = GivenProductIsPromoted();

                Time.GoForwardInDays(1);
                Promoter.SetPromotion(p);

                p.Price = 70;
                Promoter.SetPromotion(p);

                Assert.IsTrue(p.IsRedPencilPromoted);
            }
Example #11
0
            public void TwoPromotionsAfterAnother()
            {
                // After a red pencil promotion is ended additional red pencil promotions may follow
                // – as long as the start condition is valid: the price was stable for 30 days
                //       and these 30 days don’t intersect with a previous red pencil promotion.
                // --> EXAMPLE??

                Product p = new Product(100);

                p.Price = 80;
                Time.GoForwardInDays(40);
                Promoter.SetPromotion(p);
                Assert.IsTrue(p.IsRedPencilPromoted);

                Time.GoForwardInDays(31);
                Promoter.SetPromotion(p);
                Assert.IsFalse(p.IsRedPencilPromoted);


                p.Price = 70;
                Time.GoForwardInDays(31);
                Promoter.SetPromotion(p);
                Assert.IsTrue(p.IsRedPencilPromoted);
            }