How to make your code testable?
Having full control of the code under test, in essence, means that this code has no direct dependency on other pieces of code in your application and outside it. In other words: your code is broken up into loosely coupled units. Either they are fully independent or, if a dependency applies, your code allows you to control the dependency. Microsoft has been highly investing, and still is, in getting the application loosely coupled and better testable, like they have done when splitting the system and base application. They also continue doing this with the base application itself where there is still a vast number of battles to be won like in the case of the sales posting routine. Although it has been refactored significantly, there is a still massive blob of code that executes 1,000 tasks in the process of posting a sales order. We can hardly access just parts of the code, it is only possible to execute the whole thing. Imagine if the code is executed...