I spent an evening trying to mock an object that implements IQueryable:
public interface IRepo : IQueryable
{
}
The best
I think that's about the best you can do with Moq. I think a more readable option would be to roll your own FakeRepo that derives from System.Linq.EnumerableQuery:
public class FakeRepo : EnumerableQuery, IRepo
{
public FakeRepo(IEnumerable items) : base(items) { }
}
Update: You might be able to pull this off by mocking EnumerableQuery then using As:
var items = new Item[0];
var repo = new Mock(items).As();