public async void Test_LodgingRepo_GetAsyncById() { var dbOptions = await NewDb(); using (var ctx = new LodgingContext(dbOptions)) { await ctx.Database.EnsureCreatedAsync(); await ctx.SaveChangesAsync(); // Add repo-specific setup here. await ctx.SaveChangesAsync(); } using (var ctx = new LodgingContext(dbOptions)) { var repo = new LodgingRepository(ctx); // Add repo-specific method calls here. var actual = await repo.GetAsync(1); // Add Asserts here. Assert.Null(actual); } }
public async void Test_Repository_GetAsync_ById() { await _connection.OpenAsync(); try { using (var ctx = new LodgingContext(_options)) { await ctx.Database.EnsureCreatedAsync(); } using (var ctx = new LodgingContext(_options)) { var lodgings = new LodgingRepository(ctx); var actual = await lodgings.GetAsync(1); Assert.Null(actual); } using (var ctx = new LodgingContext(_options)) { var rentals = new RentalRepository(ctx); var actual = await rentals.GetAsync(1); Assert.Null(actual); } using (var ctx = new LodgingContext(_options)) { var reviews = new ReviewRepository(ctx); var actual = await reviews.GetAsync(1); Assert.Null(actual); } } finally { await _connection.CloseAsync(); } }
public async void Test_LodgingRepo_GetAsyncById() { var dbOptions = await NewDb(); using (var ctx = new LodgingContext(dbOptions)) { await ctx.Database.EnsureCreatedAsync(); await ctx.SaveChangesAsync(); } using (var ctx = new LodgingContext(dbOptions)) { var repo = new LodgingRepository(ctx); var actual = await repo.GetAsync(1, new LodgingQueryParamsModel()); Assert.Null(actual); } }
public async void Test_LodgingRepo_GetAsync_IncludeImages() { var dbOptions = await NewDb(); using (var ctx = new LodgingContext(dbOptions)) { await ctx.Database.EnsureCreatedAsync(); await ctx.SaveChangesAsync(); } using (var ctx = new LodgingContext(dbOptions)) { var repo = new LodgingRepository(ctx); var queryParams = new LodgingQueryParamsModel(); queryParams.IncludeImages = true; var actual = await repo.GetAsync(queryParams); Assert.Empty(actual); } }