Entity Framework 4.0 Unit Testing

Posted by Steve Ward on Stack Overflow See other posts from Stack Overflow or by Steve Ward
Published on 2009-12-29T03:29:24Z Indexed on 2010/05/25 8:41 UTC
Read the original article Hit count: 237

Hi, I've implemented unit testing along the lines of this article with a fake object context and IObjectSet with POCO in EF4.

http://blogs.msdn.com/adonet/archive/2009/12/17/test-driven-development-walkthrough-with-the-entity-framework-4-0.aspx

But I'm unsure how to implement a couple of methods on my fake object context for testing. I have CreateQuery and ExecuteFunction methods on my object context interface so that I can execute ESQL and Stored Procedures but I cant (easily) implement them in my fake object context.

An alternative would be to use a test double of my repository instead of a double of my object context as suggested here:

http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/c4921443-e8a3-4414-92dd-eba1480a07ad/

But this would mean my real repository isnt being tested and would seem to just bypass the issue.

Can anyone offer any recommendations?

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about entity-framework