public void TestUpdateReserveInvalid()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Reserve> reserveRepository = new BaseRepository <Reserve>(context);

            reserveRepository.Update(reserve);
        }
        public void TestGetAllLodgingsOK()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Reserve> reserveRepository = new BaseRepository <Reserve>(context);

            Reserve reserveForAFamily = new Reserve()
            {
                Id                   = Guid.NewGuid(),
                Name                 = "Martin",
                LastName             = "Gutman",
                Email                = "*****@*****.**",
                PhoneNumberOfContact = 24006478,
                DescriptionForGuest  = "Un lugar para pasar el rato con la familia, ideal para tomar un relax",
                LodgingOfReserve     = lodging,
                CheckIn              = new DateTime(2020, 10, 25),
                CheckOut             = new DateTime(2020, 12, 10),
                QuantityOfAdult      = 2,
                QuantityOfChild      = 0,
                QuantityOfBaby       = 1,
                StateOfReserve       = Reserve.ReserveState.Creada
            };

            reserveRepository.Add(reserve);
            reserveRepository.Add(reserveForAFamily);

            List <Reserve> listWithOriginalsReserves = new List <Reserve>();

            listWithOriginalsReserves.Add(reserve);
            listWithOriginalsReserves.Add(reserveForAFamily);

            List <Reserve> listOfReserveOfDb = reserveRepository.GetAll().ToList();

            CollectionAssert.AreEqual(listWithOriginalsReserves, listOfReserveOfDb);
        }
        public void TestRemoveReserveDoesntExist()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Reserve> reserveRepository = new BaseRepository <Reserve>(context);

            reserveRepository.Remove(reserve);
        }
        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 TestGetUserSessionBad()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserSessionRepository userSessionRepo = new UserSessionRepository(context);

            userSessionRepo.Get(userSession.Id);
        }
Exemple #6
0
        public void TestRemoveTouristSpotInvalid()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Remove(aTouristSpot);
        }
Exemple #7
0
        public void TestUpdateTouristSpotNullInvalid()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Update(null);
        }
Exemple #8
0
        public void TestGetTouristSpotBad()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Get(aTouristSpot.Id);
        }
        public void TestRemoveLodgingDoesntExist()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

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

            Lodging lodgingOfDb = lodgingRepository.Get(lodging.Id);
        }
        public void TestAddCategoryNullInvalid()
        {
            ContextObl          context      = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ICategoryRepository categoryRepo = new CategoryRepository(context);

            categoryRepo.Add(null);
        }
        public void TestAddLodgingNullOK()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Lodging> lodgingRepository = new BaseRepository <Lodging>(context);

            lodgingRepository.Add(null);
        }
Exemple #13
0
        public void TestGetAllRegionOK()
        {
            ContextObl           context    = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Region> regionRepo = new BaseRepository <Region>(context);

            Region regionToAdd = new Region()
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Centro_Sur
            };

            Region regionToAdd2 = new Region()
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Este
            };

            regionRepo.Add(regionToAdd);
            regionRepo.Add(regionToAdd2);

            List <Region> listTest = new List <Region>();

            listTest.Add(regionToAdd);
            listTest.Add(regionToAdd2);

            List <Region> listOfCategories = regionRepo.GetAll().ToList();

            CollectionAssert.AreEqual(listTest, listOfCategories);
        }
        public void GetAvailableLodgingsByTouristSpotNotFound()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.GetAvailableLodgingsByTouristSpot(touristSpot.Id).ToList();
        }
        public void TestRemoveUserSessionInvalid()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserSessionRepository userSessionRepo = new UserSessionRepository(context);

            userSessionRepo.Remove(userSession);
        }
        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 TestUpdateLodgingNullInvalid()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Lodging> lodgingRepository = new BaseRepository <Lodging>(context);

            lodgingRepository.Update(null);
        }
        public void TestUpdateLodgingInvalid()
        {
            ContextObl         context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ILodgingRepository lodgingRepository = new LodgingRepository(context);

            lodgingRepository.Update(lodging);
        }
Exemple #19
0
        public void TestGetTouristSpotsByCategoriesIdAndRegionIdBad()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            TouristSpot aTouristSpot2 = new TouristSpot()
            {
                Id               = Guid.NewGuid(),
                Name             = "La Paloma",
                Description      = "Un gran lugar",
                Region           = aRegion,
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                }
            };

            categoryTouristSpot.TouristSpot   = aTouristSpot2;
            categoryTouristSpot.TouristSpotId = aTouristSpot2.Id;
            aTouristSpot2.ListOfCategories.Add(categoryTouristSpot);
            touristSpotRepo.Add(aTouristSpot2);
            List <TouristSpot> listToCompare = new List <TouristSpot>()
            {
                aTouristSpot2
            };
            List <Guid> listOfCategoriesIdToSearch = new List <Guid>()
            {
                categoryTouristSpot.CategoryId
            };

            List <TouristSpot> touristSpotsByRegionAndCategories = touristSpotRepo.GetTouristSpotsByCategoriesAndRegion(listOfCategoriesIdToSearch, Guid.NewGuid());
        }
        public void TestGetAllCategoriesOK()
        {
            ContextObl          context      = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ICategoryRepository categoryRepo = new CategoryRepository(context);

            Category categoryToAdd = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Playa"
            };

            Category categoryToAdd2 = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Piscina"
            };

            categoryRepo.Add(categoryToAdd);
            categoryRepo.Add(categoryToAdd2);

            List <Category> listTest = new List <Category>();

            listTest.Add(categoryToAdd);
            listTest.Add(categoryToAdd2);

            List <Category> listOfCategories = categoryRepo.GetAll().ToList();

            CollectionAssert.AreEqual(listTest, listOfCategories);
        }
        public void TestRemoveUserInvalid()
        {
            ContextObl      context   = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserRepository userRepo  = new UserRepository(context);
            User            userToAdd = new User();

            userRepo.Remove(userToAdd);
        }
Exemple #22
0
        public void TestInvalidAddTouristSpot()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);
            IRepository <Region>   regionRepo      = new BaseRepository <Region>(context);

            regionRepo.Add(aRegion);
            touristSpotRepo.Add(null);
        }
        public void TestGetReserveOK()
        {
            ContextObl            context           = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IRepository <Reserve> reserveRepository = new BaseRepository <Reserve>(context);

            reserveRepository.Add(reserve);
            Reserve reserveOfDb = reserveRepository.Get(reserve.Id);

            Assert.AreEqual(reserve, reserveOfDb);
        }
        public void TestGetUserSessionOK()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserSessionRepository userSessionRepo = new UserSessionRepository(context);

            userSessionRepo.Add(userSession);
            UserSession userSessionOfDb = userSessionRepo.Get(userSession.Id);

            Assert.AreEqual(userSession, userSessionOfDb);
        }
        public void TestAddUserSessionOK()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserSessionRepository userSessionRepo = new UserSessionRepository(context);

            userSessionRepo.Add(userSession);
            List <UserSession> listOfUserSessions = userSessionRepo.GetAll().ToList();

            Assert.AreEqual(userSession, listOfUserSessions[0]);
        }
        public void TestGetUserSessionByToken()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserSessionRepository userSessionRepo = new UserSessionRepository(context);

            userSessionRepo.Add(userSession);
            UserSession userSessionResult = userSessionRepo.GetUserSessionByToken(userSession.Token);

            Assert.AreEqual(user, userSessionResult.User);
        }
        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);
        }
        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 TestGetUserByEmailOk()
        {
            ContextObl      context  = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            IUserRepository userRepo = new UserRepository(context);

            userRepo.Add(userToAdd);
            User userObtained = userRepo.GetUserByEmail("*****@*****.**");

            Assert.AreEqual(userToAdd, userObtained);
        }
Exemple #30
0
        public void TestGetTouristSpotByNameOk()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Add(aTouristSpot);
            TouristSpot touristSpotResult = touristSpotRepo.GetTouristSpotByName(aTouristSpot.Name);

            Assert.AreEqual(aTouristSpot, touristSpotResult);
        }