Writing the Assertion First and Working Backward
In this lesson, we will write our tests in a slightly different way. When creating a new test, we will go straight to the assertion we are trying to prove. This will ensure that test code exists solely to support the assertion, thus minimizing any code written for the tests.
Once we have the assertion, we will code backward, writing the code we need to perform the assertion. Only then will we define the test name.
For example, let's look at fizzbuzz
:
In order of writing:
   assert fizzBuzzed == "1"     var fizzBuzzed = fizzBuzzer.FizzBuzz(1)     var fizzBuzzer = new FizzBuzzer()
Final code:
    var fizzBuzzer = new FizzBuzzer() +     var fizzBuzzed = fizzBuzzer.FizzBuzz(1) +     assert fizzBuzzed == "1"