public void GetAvailableLodgingsByTouristSpotOk()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            Lodging lodgingOfConrad = new Lodging()
            {
                Id              = Guid.NewGuid(),
                Name            = "Hotel Enjoy Conrad",
                QuantityOfStars = 5,
                Address         = "Parada 4 Playa Mansa, Rambla Claudio Williman",
                PricePerNight   = 1500,
                TouristSpot     = touristSpot,
            };

            lodgingRepository.Add(lodging);
            lodgingRepository.Add(lodgingOfConrad);

            List <Lodging> listWithOriginalsLodgings = new List <Lodging>();

            listWithOriginalsLodgings.Add(lodging);
            listWithOriginalsLodgings.Add(lodgingOfConrad);

            List <Lodging> listOfLodgingOfDb = lodgingRepository.GetAvailableLodgingsByTouristSpot(touristSpot.Id).ToList();

            CollectionAssert.AreEqual(listWithOriginalsLodgings, listOfLodgingOfDb);
        }
        public void GetReviewByReserveIdTest()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IReviewRepository      reviewRepo      = new ReviewRepository(context);
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);
            ILodgingRepository     lodgingRepo     = new LodgingRepository(context);

            IRepository <Reserve> reserveRepo = new BaseRepository <Reserve>(context);

            touristSpotRepo.Add(touristSpot);
            lodgingRepo.Add(lodging);
            reserveRepo.Add(reserve);

            Review reviewToAdd = new Review()
            {
                Id                    = Guid.NewGuid(),
                Description           = "Me gusto mucho la estadia",
                IdOfReserve           = reserve.Id,
                LastNameOfWhoComments = reserve.LastName,
                NameOfWhoComments     = reserve.Name,
                LodgingOfReview       = lodging,
                Score                 = 4
            };

            reviewRepo.Add(reviewToAdd);
            Review reviewResult = reviewRepo.GetReviewByReserveId(reserve.Id);

            Assert.IsTrue(reviewResult.Equals(reviewToAdd));
        }
        public void TestRemoveLodgingOK()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Add(lodging);
            lodgingRepository.Remove(lodging);
            lodgingRepository.GetAll();
        }
        public void TestGetLodgingOK()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Add(lodging);
            Lodging lodgingOfDb = lodgingRepository.Get(lodging.Id);

            Assert.AreEqual(lodging, lodgingOfDb);
        }
        public void GetLodgingByNameAndTouristSpotTest()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Add(lodging);
            Lodging lodgingObteined = lodgingRepository.GetLodgingByNameAndTouristSpot(lodging.Name, lodging.TouristSpot.Id);

            Assert.AreEqual(lodging, lodgingObteined);
        }
Exemplo n.º 6
0
        public void TestGenerateReportWithBadTouristSpot()
        {
            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(Guid.NewGuid(), checkInDate, checkOutDate);
        }
        public void TestAddLodgingOK()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Add(lodging);

            List <Lodging> listOfLodging = lodgingRepository.GetAll().ToList();

            Assert.AreEqual(lodging, listOfLodging[0]);
        }
Exemplo n.º 8
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);
        }
        public void TestUpdateLodgingOK()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Add(lodging);

            lodging.Name = "Hotel Enjoy Conrad";

            lodgingRepository.Update(lodging);

            List <Lodging> listOfLodgings = lodgingRepository.GetAll().ToList();

            Assert.AreNotEqual("Hotel Las Cumbres", listOfLodgings[0].Name);
        }