One of the problems that I have found is that I have trouble separating the data base calls from my unit tests while still covering my repository. We are going to talk about how to get around this, and pick up after this post to avoid some of the prep work.
We First add a Test Project to the solution to house the tests.

We want to setup a Product Repository so that we can test it but we want to mock the IRepository that it takes to avoid the database call.
var mockRepository = MockRepository.GenerateMock<IRepository>();
mockRepository.Stub(x => x.AsQueryable<Product>()).Return(new List<Product>
{
new Product()
{
DaysToManufacture = 4
},
new Product()
{
DaysToManufacture = 2
}
}.AsQueryable());
var target = new ProductRepository(mockRepository);
We setup the return with a value that should get filtered and a value that should not get filtered as to give us a control set. Make sure to call the AsQueryable on the object initialization so that it matches the return type on the repository.
After we have setup the test them we call our Long running products method.
//act
var result = target.GetLongRunningProducts();
//assert
Assert.IsTrue(result.Count() == 1);
Assert.AreEqual(4, result.FirstOrDefault().DaysToManufacture);
This test now gives us the ability to test our filters and our logical separation at the repository level without a database. We can leverage this to run integration performance and query tests against the database as well, but that is another post.
Source code is here
297f59fc-9d86-4585-9299-09bcefe8dc3b|2|4.0
Data Access, Design Patterns, Entity Framework