...
This query has a very broad set of responsibilities which cannot be easily verified in isolation. On closer inspection it appears that it is in fact formed of at least 7 distinct queries. To effectively unit test this process we must the set level components that comprise the process we must encapsulate each of the subqueries into separate components so that they can be tested independently. A To achieve this there are a number of approaches are open to us including:
...