public async Task TestIfGetMostExpensiveProductsReturnEmptyCollection() { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chartsService = new SupportChartsService(context); Assert.Empty(await chartsService.GetMostExpensiveProductsAsync()); }
public async Task TestIfGetMostExpensiveProductsWorksAccordingly(string title, decimal price) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chartsService = new SupportChartsService(context); await context.Products.AddRangeAsync(new Product { Title = title, Price = price }); await context.SaveChangesAsync(); var result = await chartsService.GetMostExpensiveProductsAsync(); Assert.NotEmpty(result); Assert.Contains(result, x => x.Title == title && x.Price == price); }