public void TestAdd() { Category category = new Category() { Id = 1, Name = "Playa", Spots = null }; var repository = new CategoryRepository(_context); repository.AddAndSave(category); Assert.AreEqual(_context.Find <Category>(category.Id), category); }
public void TestAddTourist() { Tourist tourist = new Tourist() { Id = 3, Name = "Pepe", LastName = "Lopez", Email = "*****@*****.**", Bookings = null, }; var repository = new TouristRepository(_context); repository.AddAndSave(tourist); Assert.AreEqual(_context.Find <Tourist>(3), tourist); }
public void DeleteAdministratorTest() { Administrator administrator = new Administrator() { Id = 1, Email = "*****@*****.**", Password = "******" }; _context.Add(administrator); _context.SaveChanges(); var repository = new AdministratorRepository(_context); repository.Delete(administrator); Assert.IsNull(_context.Find <Administrator>(1)); }
public void TestAddBookingStage() { BookingStage bookingStage = new BookingStage() { Id = 3, Description = "Tayment", Administrator = null, AdministratorId = 0, AsociatedBooking = null, AsociatedBookingId = 0, EntryDate = DateTime.Now, Status = new Status(), }; var repository = new BookingStageRepository(_context); repository.AddAndSave(bookingStage); Assert.AreEqual(_context.Find <BookingStage>(3), bookingStage); }
public void TestAddSpot() { TouristicSpot spot = new TouristicSpot() { Id = 1, 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 = null, RegionId = 1, Categories = null, }; var repository = new TouristicSpotRepository(_context); repository.AddAndSave(spot); Assert.AreEqual(_context.Find <TouristicSpot>(1), spot); }
public void TestAddAccommodation() { List <CategoryTouristicSpot> categories = new List <CategoryTouristicSpot>(); CategoryTouristicSpot category = new CategoryTouristicSpot() { CategoryId = 1, TouristicSpotId = 5 }; categories.Add(category); TouristicSpot spot = new TouristicSpot() { Name = "h", Categories = categories, RegionId = 5 }; this._context.TouristicSpots.Add(spot); Accommodation accommodation = new Accommodation() { Id = 3, Address = "Test", Bookings = null, ContactNumber = "09934566", Full = false, Name = "Radisson", Information = "nice", PricePerNight = 1.76, Spot = spot, SpotId = 1 }; var repository = new AccommodationRepository(_context); repository.AddAndSave(accommodation); Assert.AreEqual(_context.Find <Accommodation>(3), accommodation); }
public void TestAddBooking() { List <AccommodationImage> list = new List <AccommodationImage>(); AccommodationImage image = new AccommodationImage() { AccommodationId = 1, Image = "a" }; list.Add(image); Accommodation accommodation = new Accommodation() { Id = 1, Name = "a", Address = "d", ContactNumber = "a", Images = list }; this._context.Accommodations.Add(accommodation); Booking booking = new Booking() { Id = 1, Accommodation = null, AccommodationId = 1, BookingHistory = null, CheckIn = DateTime.Now, CheckOut = DateTime.Now.AddDays(7), GuestId = 6, Guests = new List <Guest>(), HeadGuest = null, TotalPrice = 142 }; Tourist tourist = new Tourist() { Email = "*****@*****.**", LastName = "a", Name = "a" }; booking.HeadGuest = tourist; var repository = new BookingRepository(_context); repository.AddAndSave(booking); Assert.AreEqual(_context.Find <Booking>(1), booking); }
public void TestAddReview() { Booking 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 }; this._context.Bookings.Add(booking); Review review = new Review() { Id = 1, BookingId = 1, Comment = "Bueni", Score = 5 }; var repository = new ReviewRepository(_context); repository.AddAndSave(review); Assert.AreEqual(_context.Find <Review>(1), review); }