Search code examples
unit-testingentity-frameworkmockingdata-access-layer

How to correctly unit test my DAL?


I'm new to unit testing. But how do I unit test my DAL which is written with Entity Framework, so I can make sure my DAL code is working correctly but no database is actually touched? Could someone give as much detail as possible please.


Solution

  • If you want to test that your data access layer works correct you really need to test it against a database at some point as otherwise you aren't actually testing it works.