public async Task GetProductById_TestAsync() { //Arrange //var dbContext = CreateDbContext(); var productSessionRepository = new ProductSessionRepository(DbContext); int productId = 5; string productName = "Chef Anton's Gumbo Mix _ Test"; //Act var result = await productSessionRepository.GetById(productId); //Assert Assert.Equal(productId, result.ProductId); Assert.Equal(productName, result.ProductName); //Clean up DbContext.Dispose(); }
public async Task DeleteProduct_TestAsync() { //Arrange //var dbContext = CreateDbContext(); var productSessionRepository = new ProductSessionRepository(DbContext); int productId = 78; //Act await productSessionRepository.Delete(productId); var result = await productSessionRepository.GetById(productId); //Assert Assert.True(result == null); //Clean up DbContext.Dispose(); }