JuergenGutsch / blog

Personal blog about web development based on .NET and .NET Core
https://asp.net-hacker.rocks/
Other
31 stars 17 forks source link

Integration testing data access in ASP.​NET Core #176

Open utterances-bot opened 8 months ago

utterances-bot commented 8 months ago

Integration testing data access in ASP.​NET Core

https://asp.net-hacker.rocks/2019/01/18/integration-testing-data-access-dotnetcore.html

massimilianokraus-kappas commented 8 months ago

Actually .NET authors discourage mocking DbContexts and DbSets:

link

"Mocking DbSet for querying is complex and difficult, and suffers from the same disadvantages as the in-memory approach; we discourage this"

JuergenGutsch commented 7 months ago

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