2

I am wondering whether Unit Testing is possible if I use a DB-First Entity Framework model -- or shall I rather do Integrity Tests only? Can I detach the system from the DB while testing?

I already have a context factory to have maximum one context per request. I could make the factory return an interface which could be instanciated as a wrapper of the EF context OR a fake testing implementation. So I would have to manually wrap the tables and stored functions of the generated EF context (including each changes), because it is not implementing anything... Man, that would be pain in everything and surely wouldn't worth it.

So what are your recommendations about Unit (or not Unit) Testing in this environment?

Update: I'm using EF 5

2 Answers 2

3

You should take a look at this article where Julie Lerman answers to a similar question someone asked her on twitter. It will give you an overview of all the available testing techniques around EF.
Have a look at the article's comments as well where other interesting things are mentioned.

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

2 Comments

Thanks, I found lots of useful stuff here (and on blogs around this one) but not a direct solution for my question yet. (There is a very nice guide for EF4 though.)
The article has moved to here
0

Take a look at The Repository Pattern.

Comments

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.