Test able code Jiří Pokorný Jiri.Pokorny@solarwinds.com Task 1. » Improve test ability to be able extend the application: ▪ First refactoring is critical, we don’t have tests yet ▪ Extract only necessary code to internal static methods ▪ Later we are able to transform them to instance methods ▪ Best practice is to avoid „public static“ (e.g. SingleTon, Service locator) Task 1. ▪ Writing unit tests: • We are going to use „Test first“ strategy • Allow access internal members by adding InternalsVisibleTo(„Tests“) • Add new test project • Use MSTests attributes to decorate the test methods • Use Assert to validate the output • Validate „Test Coverage“ (e.g. using JetBrains dotCover) Task 2. » Add new command for multiplication: ▪ Add new failing test First ▪ Add the missing method implementation ▪ Add the command usage to the application Task 3. » Change the code so it can be used with Windows phone application User interface ▪ Extract all calls to „Console“ class ▪ Define user interaction Interface ▪ Create Fake User interface to simulate user interaction (e.g. Moq library) ▪ Write missing unit tests