❔ IAsyncEnumerable and IQueriable unit testing
I have an interface of the repository, which has a method Query<T>. This method should return IQueryble<T>
Now I wrote a service where I use this method to get some data from a database.
In this service, I'm doing something like that.
So now I need to write a unit test for it.
And this is a problem because I'm dealing with IAsyncEnumerables here.
I have a mock setup
But it doesn't work because List<T> obviously doesn't implement IAsyncEnumerable.
Any ideas on how to make it work?
2 Replies
For now, I decided to go with ToList() since it doesn't affect speed in my case. But still would be nice to know how to test it correctly when you're dealing with IQueryble and IAsyncEnumerable
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.