Ejemplo n.º 1
0
        public void AnotherPromotionMayNotBeStartedIfTheyDoOverlap()
        {
            var product   = CreateTestProduct();
            var factory   = new RedPencilFactory();
            var promotion = factory.CreatePromotion(product, DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now);

            var anotherPromotion = factory.CreatePromotion(product, DateTime.Now.Subtract(TimeSpan.FromHours(12)), DateTime.Now.AddDays(1));
        }
Ejemplo n.º 2
0
        public void PromotionCanLastUpTo30Days()
        {
            var product   = CreateTestProduct();
            var factory   = new RedPencilFactory();
            var promotion = factory.CreatePromotion(product, DateTime.Now, DateTime.Now.AddDays(30));

            Assert.AreEqual(30, (promotion.EndDate - promotion.StartDate).Days);
        }
Ejemplo n.º 3
0
        public void PriceReductionToTotalDiscountGreaterThan30PercentEndsPromotion()
        {
            var product = CreateTestProduct();

            var factory      = new RedPencilFactory();
            var promotion    = factory.CreatePromotion(product, DateTime.Now, DateTime.Now.AddDays(30));
            var promotionEnd = promotion.EndDate;

            promotion.Begin(product);
            product.SalePrice = .6;

            Assert.AreNotEqual(promotionEnd, promotion.EndDate);
        }
Ejemplo n.º 4
0
        public void PriceIncreaseDuringPromotionEndsIt()
        {
            var product = CreateTestProduct();

            var factory      = new RedPencilFactory();
            var promotion    = factory.CreatePromotion(product, DateTime.Now, DateTime.Now.AddDays(30));
            var promotionEnd = promotion.EndDate;

            promotion.Begin(product);
            product.SalePrice = .95;

            Assert.AreNotEqual(promotionEnd, promotion.EndDate);
        }
Ejemplo n.º 5
0
        public void PriceReductionDuringPromotionDoesNotProlongIt()
        {
            var product = CreateTestProduct();

            var factory         = new RedPencilFactory();
            var promotion       = factory.CreatePromotion(product, DateTime.Now, DateTime.Now.AddDays(30));
            var promotionLength = promotion.EndDate - promotion.StartDate;

            promotion.Begin(product);
            product.SalePrice = .8;

            Assert.AreEqual(promotionLength, promotion.EndDate - promotion.StartDate);
        }
Ejemplo n.º 6
0
 public void PromotionCanNotLastMoreThan30Days()
 {
     var product   = CreateTestProduct();
     var factory   = new RedPencilFactory();
     var promotion = factory.CreatePromotion(product, DateTime.Now.Subtract(TimeSpan.FromDays(31)), DateTime.Now);
 }