0

I've been reading Scott Gu's post on code first design with ASP.Net MVC 2.0 and EF4 here:

http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

In the post he uses the SQL CE4 database for development and 'seeds' test data.

My question is related to testing. It is widely regarded that we should not test against a database for reasons such as speed, having to write 'clean up' code and to eliminate errors from the database itself.

If we use SQL CE4 as in the post, we can regenerate and seed with data very quickly and the database is file based and within our solution.

Is it still bad practice to test against this database directly?

Thanks

Davy

1 Answer 1

1

I would still test against an in memory repository (or mock if that's your preferred method of testing) rather than testing the sql CE4 database. While you have less of a chance of something going wrong than with a full SQL server, you are still assuming that windows won't have any issues accessing the database file at any given time. Any errors accessing sql CE at that time will cause all your tests to fail. In memory repositories have a much lower chance of having an issue.

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

1 Comment

Yeah, I think I got the wrong end of the stick when I read this the first time. Im Memory it is.

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.