ASP.Net Core unit testing async controller [duplicate]
This question already has an answer here: How to mock an async repository with Entity Framework Core 4 answers I have this test: [Fact] public async void Can_Paginate() { //fake data var product1 = new Product { ProductId = 1, ProductName = "P1" }; var product2 = new Product { ProductId = 2, ProductName = "Product 2" }; var product3 = new Product { ProductId = 3, ProductName = "Product 3" }; var product4 = new Product { ProductId = 4, ProductName = "Product 4" }; var product5 = new Product { ProductId = 5, ProductName = "Product 5" }; var data = new List<Product> { product1, product2, product3