public async void AddTour_MemoryDb_ShouldBePresentInDb() { string tourName = "Tour1"; var options = new DbContextOptionsBuilder <ExploreDb>().UseInMemoryDatabase(databaseName: "Add_writes_to_database").Options; using (var context = new ExploreDb(options)) { var tourRepo = new TourRepository(context); var unit = new UnitOfWork(context, tourRepo, new ReservationRepository(context)); var tourService = new TourService(unit); var tour = new TourDto() { Name = tourName }; await tourService.AddTourAsync(tour); var result = await context.Tours.SingleAsync(); Assert.Equal(result.Name, tourName); } }
public ReservationRepository(ExploreDb db) { this.exploreDb = db; }
public TourRepository(ExploreDb db) { this.exploreDb = db; }