public async Task GetPieAsync_WhenCalledWithInvalidId_ReturnsNull() { // Arrange int pieId = 12; var sut = new PieService(dbContext); // Act var result = await sut.GetPieAsync(pieId); // Assert Assert.Null(result); }
public async Task GetPieAsync_WhenCalledWithValidId_ReturnsPieOfGivenIdWithCategory(int pieId) { // Arrange var sut = new PieService(dbContext); // Act var result = await sut.GetPieAsync(pieId); // Assert Assert.NotNull(result); Assert.Equal(pieId, result.Id); Assert.NotNull(result.Category); }
public async Task GetPieAsync_WhenCalledWithInvalidId_ReturnsNull(int pieId) { // Act Pie pie = null; using (var context = new OnlineShopContext(options)) { var sut = new PieService(context); pie = await sut.GetPieAsync(pieId); } // Assert Assert.Null(pie); }
public async Task GetPieAsync_WhenCalledWithValidId_ReturnsPieWithIdWithCategory(int pieId) { // Act Pie pie = null; using (var context = new OnlineShopContext(options)) { var sut = new PieService(context); pie = await sut.GetPieAsync(pieId); } // Assert Assert.NotNull(pie); Assert.Equal($"Pie{pieId}", pie.Name); Assert.NotNull(pie.Category); }