In order to be able to test your software without applying many dirty hacks, you have to embrace a couple of architectural patterns that allow you to isolate the pieces of code that you want to test. I will explain a few principles that are crucial if you want to build good, testable software. More...