public async Task TestGetAllReservationsWithDinnerFromHotel() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var reservationRepository = new EfDeletableEntityRepository <Reservation>(new ApplicationDbContext(options.Options)); await reservationRepository.AddAsync(new Reservation { Id = Guid.NewGuid().ToString(), HasDinner = true, Room = new Room { Number = "100", HotelId = 1, }, ReturnDate = DateTime.UtcNow.AddDays(5), ArrivalDate = DateTime.UtcNow.AddDays(-5), }); await reservationRepository.AddAsync(new Reservation { Id = Guid.NewGuid().ToString(), HasDinner = false, Room = new Room { Number = "200", HotelId = 1, }, ReturnDate = DateTime.UtcNow.AddDays(5), ArrivalDate = DateTime.UtcNow.AddDays(-5), }); await reservationRepository.SaveChangesAsync(); var reservationsService = new ReservationsService(reservationRepository); AutoMapperConfig.RegisterMappings(typeof(MyTestReservation).Assembly); var reservations = reservationsService.GetActiveReservationsWithDinner <MyTestReservation>(1); Assert.Single(reservations); }