The goal here is to get some WCF Data Services query scenarios accurately reflected in code under test.
Following the same pattern for mocking EF functionality detailed here, I'm mocking a DataServiceQuery wrapper class and delegating to the IQueryable returned by calling .AsQueryable() on my test data.
I want to override the LINQ to objects behavior for a specific equality expression (if it matters, when comparing two byte arrays). I want to compare the values in the arrays instead of the references (e.g. using SequenceEqual
).
The way I can see accomplishing this is to create a provider where I visit the expression, pull out the appropriate values, compose a new expression, and pass that along to the LINQ to objects provider. That's a lot of work. Short of doing this, is there an easier way to get this done or will I have to resort to parsing expressions?