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); }