public async void Test_ReviewRepo_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 ReviewRepository(ctx); // Add repo-specific method calls here. var actual = await repo.GetAsync(1); // Add Asserts here. Assert.Null(actual); } }
/// <summary> /// 专家评分表显示 /// </summary> /// <param name="reviewId"></param> /// <returns></returns> public async Task <IActionResult> RateTable(int reviewId) { var review = await ReviewRepository.GetAsync(reviewId); var rateTable = await ReviewManager.GetRateTable(review); return(View(rateTable)); }
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_ReviewRepo_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 ReviewRepository(ctx); var actual = await repo.GetAsync(1, new ReviewQueryParamsModel()); Assert.Null(actual); } }