views:

258

answers:

2

It should parse EDMX file and create a moch/fake to use in Unit tests. The easiest integration would be by using T4 that we already have in VS IDE.

Has anybody seen it on the web?
Or is maybe writing it on their own?
Or is there an OSS in progress doing this?

Anybody?

+2  A: 

It would be great if there was a way to do it, but as far as I know no way exists.

When it comes to testing Entity Framework, I've had the most success using a respository with methods for add/update/delete, and abstracting DataContext with an IQueryable and a Unit of Work. I can mock my repositories for testing, and then use an Entity Framework implementation of my repositories for the live application.

Darren
A: 

When using EF4

EF4 supports ObjectContext mocking. Right click in entity designer (in empty area) within Visual Studio and select Add Code Generation Item, navigate to online templates and voila. There's ADO.NET Mocking Context Generator.

It will create a mock based on your EDMX using a T4.

Robert Koritnik