public void TestGetAllTouristsOk() { List <Tourist> touristsToReturn = new List <Tourist>() { new Tourist() { Id = 1, Name = "Juan", LastName = "Perez", Email = "*****@*****.**", Bookings = null, }, new Tourist() { Id = 2, Name = "Pepe", LastName = "Lopez", Email = "*****@*****.**", Bookings = null, }, }; touristsToReturn.ForEach(s => _context.Add(s)); _context.SaveChanges(); var repository = new TouristRepository(_context); var result = repository.GetAll(); Assert.IsTrue(touristsToReturn.SequenceEqual(result)); }
public void TestGetAllRegionsOk() { List <Region> regionsToReturn = new List <Region>() { new Region() { Id = 1, Name = "Region Pajaros Pintados", Spots = null }, new Region() { Id = 2, Name = "Region Metropolitana", Spots = null }, }; regionsToReturn.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new RegionRepository(_context); var result = repository.GetAll(); Assert.IsTrue(regionsToReturn.SequenceEqual(result)); }
public void TestGetAllBookingsOk() { List <Booking> bookingsToReturn = new List <Booking>() { new Booking() { Id = 1, Accommodation = new Accommodation() { Name = "b" }, AccommodationId = 1, BookingHistory = new List <BookingStage>(), CheckIn = DateTime.Now, CheckOut = DateTime.Now.AddDays(3), GuestId = 2, Guests = new List <Guest>(), HeadGuest = new Tourist() { Email = "*****@*****.**" }, TotalPrice = 35 }, new Booking() { Id = 2, Accommodation = new Accommodation() { Name = "a" }, AccommodationId = 1, BookingHistory = new List <BookingStage>(), CheckIn = DateTime.Now, CheckOut = DateTime.Now.AddDays(7), GuestId = 6, Guests = new List <Guest>(), HeadGuest = new Tourist() { Email = "*****@*****.**" }, TotalPrice = 142 }, }; bookingsToReturn.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new BookingRepository(_context); var result = repository.GetAll(); Assert.IsTrue(bookingsToReturn.SequenceEqual(result)); }
public void GetAllAccommodationsTest() { List <Accommodation> accommodationsToReturn = new List <Accommodation>() { new Accommodation() { Id = 1, Address = "Test", Bookings = null, ContactNumber = "09934566", Full = false, Name = "Radisson", Information = "nice", PricePerNight = 1.76, Spot = new TouristicSpot() { Name = "a" }, SpotId = 1 }, new Accommodation() { Id = 2, Address = "Test1", Bookings = null, ContactNumber = "0993456611", Full = false, Name = "Hilton", Information = "Epic", PricePerNight = 120.76, Spot = new TouristicSpot() { Name = "h" }, SpotId = 2 }, }; accommodationsToReturn.ForEach(a => _context.Add(a)); _context.SaveChanges(); var repository = new AccommodationRepository(_context); var result = repository.GetAll(); Assert.IsTrue(accommodationsToReturn.SequenceEqual(result)); }
public void TestGetAllAdministrator() { List <Administrator> administratorsToReturn = new List <Administrator>() { new Administrator() { Id = 1, Email = "*****@*****.**", Password = "******" }, new Administrator() { Id = 2, Email = "*****@*****.**", Password = "******" }, new Administrator() { Id = 3, Email = "*****@*****.**", Password = "******" }, }; administratorsToReturn.ForEach(a => _context.Add(a)); _context.SaveChanges(); var repository = new AdministratorRepository(_context); var result = repository.GetAll(); Assert.IsTrue(administratorsToReturn.SequenceEqual(result)); }
public void TestGetAllCategoriesOk() { List <Category> categoriesToReturn = new List <Category>() { new Category() { Id = 1, Name = "Playa", Spots = null }, new Category() { Id = 2, Name = "Pradera", Spots = null }, }; categoriesToReturn.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new CategoryRepository(_context); var result = repository.GetAll(); Assert.IsTrue(categoriesToReturn.SequenceEqual(result)); }
public void TestGetAllSpotsOk() { List <TouristicSpot> spotsToReturn = new List <TouristicSpot>() { new TouristicSpot() { Id = 1, Name = "Villa Serrana", Accommodations = new List <Accommodation>(), Description = "Villa Serrana es un poblado ubicado en el departamento de Lavalleja de Uruguay," + " a 25 kilómetros al noreste de la capital departamental," + " Minas, entre los valles de los arroyos Penitente y Marmarajá.", Region = new Region(), RegionId = 1, Categories = null, }, new TouristicSpot() { Id = 2, Name = "Colonia del Sacramento", Accommodations = null, Description = "Es conocida por su Barrio Histórico con calles de" + " adoquines rodeadas de edificios que datan de la" + " época en que era un asentamiento portugués.", Region = new Region(), RegionId = 2, Categories = null, }, }; spotsToReturn.ForEach(s => _context.Add(s)); _context.SaveChanges(); var repository = new TouristicSpotRepository(_context); var result = repository.GetAll(); Assert.IsTrue(spotsToReturn.SequenceEqual(result)); }
public void TestGetAllBookingStagesOk() { List <BookingStage> bookingStagesToReturn = new List <BookingStage>() { new BookingStage() { Id = 1, Description = "The booking was added correctly, awaiting payment", Administrator = new Administrator() { Email = "*****@*****.**" }, AdministratorId = 0, AsociatedBooking = new Booking(), AsociatedBookingId = 0, EntryDate = DateTime.Now, Status = new Status(), }, new BookingStage() { Id = 2, Description = "The booking was rejected due to payment issues, please contact your bank", Administrator = new Administrator() { Email = "*****@*****.**" }, AdministratorId = 0, AsociatedBooking = new Booking(), AsociatedBookingId = 0, EntryDate = DateTime.Now, Status = new Status(), }, }; bookingStagesToReturn.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new BookingStageRepository(_context); var result = repository.GetAll(); Assert.IsTrue(bookingStagesToReturn.SequenceEqual(result)); }
public void TestGetAllReviewsOk() { List <Review> reviewsToReturn = new List <Review>() { new Review() { Id = 1, Comment = "Horrible", Score = 3, BookingId = 2 }, new Review() { Id = 2, Comment = "Bueni", BookingId = 1, Score = 5 }, }; _context.Add(new Accommodation() { Name = "b", Id = 1 }); _context.Add(new Booking { Id = 1, AccommodationId = 1, BookingHistory = new List <BookingStage>(), CheckIn = DateTime.Now, CheckOut = DateTime.Now.AddDays(3), GuestId = 2, Guests = new List <Guest>(), HeadGuest = new Tourist() { Email = "*****@*****.**" }, TotalPrice = 35 }); _context.Add(new Booking { Id = 2, AccommodationId = 1, BookingHistory = new List <BookingStage>(), CheckIn = DateTime.Now, CheckOut = DateTime.Now.AddDays(3), GuestId = 2, Guests = new List <Guest>(), HeadGuest = new Tourist() { Email = "*****@*****.**" }, TotalPrice = 35 }); reviewsToReturn.ForEach(r => _context.Add(r)); _context.SaveChanges(); var repository = new ReviewRepository(_context); var result = repository.GetAll(); Assert.IsTrue(reviewsToReturn.SequenceEqual(result)); }