Click here to Skip to main content
15,881,248 members
Articles / DevOps / Unit Testing

Two Strategies for Testing Entity Framework - Effort and SQL CE

Rate me:
Please Sign up or sign in to vote.
4.97/5 (14 votes)
19 Sep 2012CPOL6 min read 117.5K   2.5K   27  
Two approaches for unit testing Entity Framework
In this article, you will learn about two approaches for unit testing Entity Framework: Mocking in memory by using "Effort", and against a real database using SQLCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestingEf.Data.Tests.TestDatabaseStrategies
{
    public class TestDatabaseStrategyFactory
    {
        public static ITestDatabaseStrategy CreateFakeDatabase()
        {
            return new EffortDatabaseStrategy();
        }

        public static ITestDatabaseStrategy CreateRealDatabase()
        {
            return new SqlCeDatabaseStrategy();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions