Question

Is it possible to mock an EF model so that I can test code which uses the model classes without getting rid of LINQ to Entities code strewn throughout my project? Or will it be necessary to set up a test database for the model to hit instead?

Was it helpful?

Solution

You could wrap your LINQ code in Data Access Objects. The DAOs would have separate interface and implementation code. Your test code would mock the DAOs.

If you don't want to do that, you'll need a test DB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top