Open utterances-bot opened 8 months ago
Actually .NET authors discourage mocking DbContexts and DbSets:
"Mocking DbSet for querying is complex and difficult, and suffers from the same disadvantages as the in-memory approach; we discourage this"
True but pretty much depends on the context and what you actually like to test. If you just need to fetch data I don't see any risk in mocking DbSets
Integration testing data access in ASP.NET Core
https://asp.net-hacker.rocks/2019/01/18/integration-testing-data-access-dotnetcore.html