Entity Framework (code first) in a memory database for unit testing

In order to test the modules can this be done:

  • Is there test data in some format (XML?) In the control source
  • When testing unit tests, create an instance of any of the memory database from this test data.
  • If EF works with this in the memory database for unit test run

?

We do not want our unit tests to rely on a specific external database, present and in a certain state.

We also do not want to support two different "worlds" in our code and tests, in the real world, where EF works against real db and fake work, where our tests work against some kind of EF dummy.

+5
source share
1

. ( ) , , , .

XML EF, , : "" . EF, . MS SQL Server MS SQL Server Compact Edition , .

:

  • EF ( Linq-to-entities) EF
  • , .
+6

All Articles