How do I mock IQueryable<T>
I am creating a repository that exposes IQueryable. What is the best way to mock this out for my unit testing? Since I am using RhinoMocks for the rest of my mock objects, I tried to do the following: IQueryable<MyObject> QueryObject = MockRepository.GenerateStub<IQueryable<MyObject>>(); This doesn't work though so I tried doing this: IQueryable<MyObject> QueryObject = (new List<MyObject> { new MyObject() }).AsQueryable(); Is there a better way to do this, or have any other mocking frameworks built support for IQueryable in? My repository interface looks like this: public interface IRepository