Untestable Code - Observations

Activity 1

After refactoring the code, and you start to think about the test, you begin to realise there is no state data available to write an Assert statement. This is an important learning point. Most testing centers around invoking methods that return a value. This returned value can be tested in an Assert statement. But the ProcessData() method is a void. So how do we verify its results? The answer is in the type of testing. We need to shift from Black Box Testing (treating the method as a concealed box where you invoke the method possibly passing in values, and expect a value back. Because it is a concealed box you ignore the internal mechanisms and focus on the input and output values) to White Box Testing (treating the method as a transparent box, so you actively look for points in the method where you can inject a test feature into the method so that it can provide feedback on the behaviour of the method to the unit test).