I tried to test async repo method, I mocked dbcontext, and did same as microsoft’s documentaiton suggested (https://learn.microsoft.com/en-us/ef/ef6/fundamentals/testing/mocking?redirectedfrom=MSDN#testing-with-async-queries), I use the .net 8.0,
at the last step var blogs = service.GetAllBlogsAsync().Result;
I will get this error
System.AggregateException: ‘One or more errors occurred. (The source ‘IQueryable’ doesn’t implement ‘IAsyncEnumerable<TestAsync.Blog>’. Only sources that implement ‘IAsyncEnumerable’ can be used for Entity Framework asynchronous operations.)’
anyone can help, thanks.
I did exaclty same as Nicrosoft suggested and searched online, still didn’t work
David Zhu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.