I am using SQL Server with Entity Framework for a development of web app in .NET 4 with VS2010 RC. I would like to prepare testing database with sample data.
Should I prepare a copy of the real database (say another SQL Server database) for testing, or can I use SQLite in memory for better performance?
If using SQLite, can I use the same model EF has created for SQL Server database? How to migrate schema from SQL Server to in-memory SQLite?
How are you testing your code that uses EF with SQL Server?
Thanks for sharing.
I use LINQ to Objects and DI.
So let’s say I have a service which uses a repository:
Now I can use constructor injection to inject a mock repository for testing. Generally, you’d use a DI framework for this. But the important thing is the mock repository can use LINQ to Objects:
Now I can test: