Sunday, October 03, 2010

The three step guide to unit testing Entity Framework 4.0

Rab Hallett's blog - Unit Testing Entity Framework 4.0: A-Z in 3 Easy Steps

“This article gives you an ultra-fast run down on how to start Unit Testing in Entity Framework 4.0 using C#; applying a suitable Code Generation Item to your Entity Data Model (EDMX) file, and building a Unit Test Project in Visual Studio 2010.

No external test harness is required, it doesn't rely on having a Repository pattern being implemented and you don't need to buy any new products. Just Visual Studio 2010 Professional Edition, Premium Edition or Ultimate Edition out of the box.

Step 1: Set Up the Code Generation Item

Step 2: Ensure "Context Agnostic" Code

Step 3: Create the Unit Tests

image…”

I am working on a personal project that uses EF and was just thinking about how to unit test it…

No comments: