Пример #1
0
        public void TestRemoveTouristSpotOK()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Add(aTouristSpot);
            touristSpotRepo.Remove(aTouristSpot);
            touristSpotRepo.GetAll();
        }
Пример #2
0
        public void TestAddTouristSpotOK()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);
            IRepository <Region>   regionRepo      = new BaseRepository <Region>(context);

            regionRepo.Add(aRegion);
            touristSpotRepo.Add(aTouristSpot);
            List <TouristSpot> listOfTouristSpots = touristSpotRepo.GetAll().ToList();

            Assert.AreEqual(aTouristSpot, listOfTouristSpots[0]);
        }
Пример #3
0
        public void TestUpdateTouristSpotOK()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Add(aTouristSpot);
            aTouristSpot.Name = "Piscinas";
            touristSpotRepo.Update(aTouristSpot);
            List <TouristSpot> listOfTouristSpots = touristSpotRepo.GetAll().ToList();

            Assert.AreEqual("Piscinas", listOfTouristSpots[0].Name);
        }
Пример #4
0
        public void TestGetAllTouristSpotsOK()
        {
            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
            };

            touristSpotRepo.Add(aTouristSpot);
            touristSpotRepo.Add(aTouristSpot2);
            List <TouristSpot> listTest = new List <TouristSpot>();

            listTest.Add(aTouristSpot);
            listTest.Add(aTouristSpot2);
            List <TouristSpot> listOfTouristSpots = touristSpotRepo.GetAll().ToList();

            CollectionAssert.AreEqual(listTest, listOfTouristSpots);
        }