public async Task GetPiesAsync_WhenCalled_ReturnsAllPiesWithCategory() { // Arrange var sut = new PieService(dbContext); // Act var result = await sut.GetPiesAsync(); // Assert Assert.Equal(pies.Count, result.Count()); Assert.NotNull(result.First().Category); Assert.NotNull(result.Last().Category); }
public async Task GetPiesAsync_WhenCalled_ReturnsAllPiesWithCategory() { // Act List <Pie> pies = null; using (var context = new OnlineShopContext(options)) { var sut = new PieService(context); pies = (await sut.GetPiesAsync()).ToList(); } // Assert Assert.NotNull(pies); Assert.Equal(6, pies.Count()); Assert.NotNull(pies[0].Category); Assert.NotNull(pies[1].Category); Assert.NotNull(pies[2].Category); Assert.NotNull(pies[3].Category); Assert.NotNull(pies[4].Category); Assert.NotNull(pies[5].Category); }