Ejemplo n.º 1
0
        public void WhenTheQueryIsForA(DayOfWeek dayOfWeek)
        {
            var date = DateTime.Today;
            while (date.DayOfWeek != dayOfWeek)
            {
                date = date.AddDays(1);
            }

            var promotablePrice = new PromotablePrice
                {
                    Rate = 1,
                    WasRate = 1,
                    RatePlanId = 1,
                    RoomTypeId = 1,
                    Date = date
                };

            resultOfPromos = new List<IPromotable> {promotionCalculator.CalculatePriceForDate(promotionsAvailable, promotablePrice)};
        }
Ejemplo n.º 2
0
            public void CalculatePriceForDateVerifyCacheIsUsed()
            {
                // Arrange
                var cacheMock = new Mock<IPromotionCache<List<Promotion>, long>>();

                Cache.PromoCache = cacheMock.Object;
                cacheMock
                    .Setup(x => x.TryGetValue(It.IsAny<long>()))
                    .Returns(GetPromotionsAvailable());
                long businessId = 1;
                var priceToCalculate = new PromotablePrice
                {
                    RatePlanId = RATE_PLAN_ONE,
                    Rate = 10,
                    WasRate = 15,
                    Date = DateTime.UtcNow.Date,
                    RoomTypeId = ROOMTYPE_ONE
                };
               

                IEnumerable<IPromotable> pricesToCalculate = new List<IPromotable> { priceToCalculate };

                var result = promoCalculator.CalculatePriceForDate(businessId, priceToCalculate);
                Assert.AreEqual(result.PromoName, BIG, "Expected BIG promotion");
                
             //Reset cache  
                Cache.PromoCache = new PromotionCache(null,null,false);

               
            }
Ejemplo n.º 3
0
 public void WhenThePriceToChangeIsWith(int ratePlan, decimal rate, decimal wasrate, int roomtype, int days)
 {
     var promotablePrice = new PromotablePrice
         {
             Rate = rate,
             WasRate = wasrate,
             RatePlanId = ratePlan,
             RoomTypeId = roomtype,
             Date = DateTime.Now.AddDays(days)
         };
     resultOfPromos = new List<IPromotable> {promotionCalculator.CalculatePriceForDate(promotionsAvailable, promotablePrice)};
 }
Ejemplo n.º 4
0
            private PromotablePrice GetPromotablePrice()
            {
                var price = new PromotablePrice
                {
                    RatePlanId = RATE_PLAN_ONE,
                    Rate = 10,
                    WasRate = 15,
                    Date = DateTime.UtcNow.Date,
                    RoomTypeId = ROOMTYPE_ONE
                };
                return price;

            }