title: Is it possible to stub Entity Framework context and classes to test data access layer?
body: <p>I'm familiar with techniques used for testing controllers and business logic in ASP .NET MVC application.</p>
  
  <p>Data access in our app is concentrated in special services which are loosely coupled, use interfaces and work with actual database through Entity Framework.</p>
  
  <p>However, as DAL became increasingly more complex, hiding away database implementation details and providing application code with abstractions, we became concerned if we are able to test it by any means. Because it is already tightly bound to EF context, we don't plan to introduce yet another repository-style layer, however this also means we can't just unit-test it with fake data.</p>
  
  <p>I'm wondering <strong>if it's possible to somehow mock or stub Entity Framework object context while being able to do simple operations like adding/deleting entities and making queries</strong>.</p>
  
  <p><strong>I'm also looking for opinion on whether it is a good idea at all (perhaps really bad), and if it isn't, some 'smart' data layer testing advice.</strong></p>