- Two projects had to be added to the solution: A class library project where the code to be tested has been factored out, and a class library containing the unit-tests.
- The configuration could no longer be read directly from the app.config, because it had to be changable programatically, so a ConfigurationManager had to be introduced.
- An additional interface had to be introduced for the ConfigurationManager so that it could be stubbed out.
- A second constructor had to be added which took a ConfigurationManager as a parameter.
- The run method contained an infinite while loop and needed therefore to be split into two methods.
- Finally, all the unit-tests, of course, had to be written :)
Saturday, February 17, 2007
Unit testing, lessons learned
I was doing a small application and thought of using the opportunity to see what additional effort it would require to make it unit-testable.