Example #1
0
        /// <summary>
        /// Gets bargains from the bargains for more api client
        /// </summary>
        /// <param name="destinationId"></param>
        /// <param name="nights"></param>
        /// <returns></returns>
        public async Task <List <PropertyBO> > FindBargains(int destinationId, int nights)
        {
            List <Property> properties = await _Client.FindBargains(destinationId, nights);

            List <PropertyBO> propertiesBO = _Mapper.Map <List <PropertyBO> >(properties);

            propertiesBO.
            ForEach(p => p.Rates.
                    ForEach(r => r.FinalPrice =
                                RateHelper.Calculate(r.RateType, nights, r.FinalPrice)));

            return(propertiesBO);
        }
        public void Test_With_False_RateType()
        {
            var result = RateHelper.Calculate("FalseRateTYPE", 1, 200);

            Assert.Equal <double>(200, result);
        }
        public void Test_With_Correct_RateType_With_Different_Camelcase()
        {
            var result = RateHelper.Calculate("PERNight", 3, 200);

            Assert.Equal <double>(600, result);
        }
        public void Test_With_Correct_RateType_3_Nights()
        {
            var result = RateHelper.Calculate("PerNight", 3, 200);

            Assert.Equal <double>(600, result);
        }