I have uploaded the solution code to my Gist. In brief, the gist code has just removed the logic to create a mocked instanc from the original code. To do so, I need to access to the MockQueryable<T>
class which is internal class, so I used the .NET reflection.
To avoid the reflection code, you can copy the code of MockQueryable<T>
from Moq source to your test code, as well as some internal types related with MockQueryable<T>
if needed.