When Query Objects are a first level concern

time to read 1 min | 133 words

I mentioned that I recently had a shift in my think about having services that return query objects. Now I have more interesting problems. How do I test such a thing? To be more accurate, how do you test such a thing in an accurate & maintainable way? To say that queries can be complicated is an understatement. You can try to deconstruct the query, but is this a really good idea? Something as simple a inner vs. left join can have interesting implications.

I guess that I am asking whatever this approach still allows for a Unit Test.

Right now I am testing that against an in memory database, so it mostly involved setting up the data, calling the service that returns the query, execute that and verify the results.

Any thoughts?