so there is no guarantee that I have valid Linq2Entity expression"
Congratulations, you've just discovered a reason, why IObjectSet<T>
, IRepository<T>
and etc. shouldn't be implemented for IQyeryable<T>
. And the reason is simple: query, which is valid for one LINQ provider, can be invalid for another one (even if you just change databases from MS SQL to something other).
And there's no generic way to verify those queries.
So, unit-testing isn't a good choice for IQyeryable<T>
, but integration testing is a definitely the thing that you need.