views:

56

answers:

2

I've found that Linq2Sql doesn't (Rhino) mock well, as the interfaces I need aren't there. Does EF generate code that's more mockable?

NOTE: I'm not mocking, yet, without interfaces, the next reader of this question may not have my bias.

EDIT: VS2008 / 3.5 for now.

+1  A: 

I would think that if, for example, you have Data Access Objects (DAOs) over your Linq2SQL objects they can implement intefaces and therefore work well with RhinoMocks.

Joe R
That's what I do. I have a layer of domain objects that are fully mockable/testable with my application code/services. Then I use AutoMapper to move the data between the domain objects and the Linq2SQL objects.
Patrick Steele
+2  A: 

Entity Framework 1.0 is mockable: http://blogs.msdn.com/diego/archive/2008/03/03/unit-testing-your-entity-framework-domain-classes.aspx

It's not pretty, but it's possible. EF 4 is much improved over EF 1.0 in this regard.

Dave Swersky