4

I'm trying to do some Moq testing against Entity Framework 4. Is there a simple way to do it, like changing the connection type on the entities? Has anyone out there done this?

Thanks

1
  • 3
    Really, really nebulous question here -- perhaps you could post a sample of what you are trying to achieve. The short general answer is "you don't test infrastructure with mocking, you hide infrastructure with mocking" Commented Nov 11, 2010 at 22:39

1 Answer 1

1

If you're not doing it already, you should be using the POCO template for the Entity Framework if you wish to set up proper fake objects to test against. I don't know of a walkthrough that specifically covers the Moq framework, but you should be able to get the generally idea of how to write tests for the Entity Framework using fake objects via this tutorial:

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

And also this video from Julie Lerman demonstrating the POCO template, which is possibly to what PsychoCoder was referring:

http://msdn.microsoft.com/en-us/data/ff717739

Sign up to request clarification or add additional context in comments.

2 Comments

All I get with the msdn link is : THE BLOG YOU ARE ATTEMPTING TO ACCESS IS SCHEDULED FOR MIGRATION, PLEASE CHANGE YOUR URL TO GO TO HTTP://BLOGS.MSDN.COM OR HTTP://BLOGS.TECHNET.COM, ONCE THE BLOG IS MIGRATED, YOU WILL AUTOMATICALLY GET REDIRECTED TO THE NEW BLOG SITE
@Jerry, while I can't say where MSDN moved the blog to, you can see it in its original form on the Wayback Machine: Walkthrough: Test-Driven Development with the Entity Framework 4.0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.