I have be trying to look for an effective way in unit testing my data access layer in C#. I\'m primary a Java developer and have only used C# for about 6 months, in the past
To test DataAccess Layer you will need a more complex structure.
DataAccess Layer will call references from Repository objects. Repo object will call references from Entity Framework DbSets via UnitOfWork design pattern.
DataAccess Layer (TOP)
|
UnitOfWork
|
Repository Pattern Classes
|
EF Context
|
Actual Database
After you set structure, then you will mock repository classes. For example, items will be inserted to DB instead will go to mock object. Later you will assert against your mock object to see item inserted or not.
Please take a look at Implementing the Repository and Unit of Work Patterns