示例#1
0
        public void TestGenerateReportWithoutLodgings()
        {
            ContextObl             context               = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository     lodgingRepository     = new LodgingRepository(context);
            ITouristSpotRepository touristSpotRepository = new TouristSpotRepository(context);
            ICategoryRepository    categoryRepository    = new CategoryRepository(context);

            categoryRepository.Add(aCategory);
            touristSpotRepository.Add(touristSpot);
            lodgingRepository.Add(lodging);

            DateTime checkInDate  = new DateTime(2020, 05, 24);
            DateTime checkOutDate = new DateTime(2020, 06, 11);

            List <Lodging> listOfLodgingsWithReserve = lodgingRepository.GetLodgingsWithReserves(touristSpot.Id, checkInDate, checkOutDate);
        }
示例#2
0
        public void TestGenerateReportOKWithMoreReserves()
        {
            ContextObl             context               = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository     lodgingRepository     = new LodgingRepository(context);
            ITouristSpotRepository touristSpotRepository = new TouristSpotRepository(context);
            ICategoryRepository    categoryRepository    = new CategoryRepository(context);
            IRepository <Reserve>  reserveRepository     = new BaseRepository <Reserve>(context);

            categoryRepository.Add(aCategory);
            touristSpotRepository.Add(touristSpot);
            lodgingRepository.Add(lodging);
            lodgingRepository.Add(lodging2);
            reserve.LodgingOfReserve = lodging3;
            reserveRepository.Add(reserve);
            reserveRepository.Add(reserve2);

            DateTime checkInDate  = new DateTime(2020, 05, 24);
            DateTime checkOutDate = new DateTime(2020, 06, 11);

            List <Lodging> listOfLodgingsWithReserve = lodgingRepository.GetLodgingsWithReserves(touristSpot.Id, checkInDate, checkOutDate);

            Assert.IsTrue(listOfLodgingsWithReserve.Contains(lodging3));
        }
示例#3
0
        public void TestGenerateReportOK()
        {
            ContextObl             context               = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository     lodgingRepository     = new LodgingRepository(context);
            ITouristSpotRepository touristSpotRepository = new TouristSpotRepository(context);
            ICategoryRepository    categoryRepository    = new CategoryRepository(context);
            IRepository <Reserve>  reserveRepository     = new BaseRepository <Reserve>(context);

            categoryRepository.Add(aCategory);
            touristSpotRepository.Add(touristSpot);
            lodgingRepository.Add(lodging);
            lodgingRepository.Add(lodging2);
            reserveRepository.Add(reserve);

            DateTime checkInDate  = new DateTime(2020, 05, 24);
            DateTime checkOutDate = new DateTime(2020, 06, 11);

            List <Lodging> listOfLodgingsWithReserve = lodgingRepository.GetLodgingsWithReserves(touristSpot.Id, checkInDate, checkOutDate);

            Assert.IsTrue(listOfLodgingsWithReserve[0].Equals(lodging) &&
                          listOfLodgingsWithReserve.Count == 1 &&
                          listOfLodgingsWithReserve[0].QuantityOfReserveForThePeriod(checkInDate, checkOutDate) == 1);
        }