public async Task TestGetAllReservationsWithBreakfastFromHotel() { 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(), HasBreakfast = 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(), HasBreakfast = 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.GetActiveReservationsWithBreakfast <MyTestReservation>(1); Assert.Single(reservations); }