Let's write our next few tests. In these tests we score a normal game in which there
are no strikes or spares. We throw the ball down the lane and knock down a single pin.
Let's compile and run the test.
1 test failed "Expected: 20 But was: 0"
We need to get this code passing. Looking at the score method we are returning a
0. This is because we are at the "constant" stage of
Uncle Bob's Transformation Priority Premise. We need to move to the level
of "scalar". This will be a variable to hold the score of the game.
Compile and run the tests.
2 tests passed
Now that our tests are passing, we can do some refactoring.
Both tests instantiate a new Game.
Both tests have a loop that rolls the ball.
Let's extract this duplicate code out.
The SetUp attribute indicates code that should run before each test. Before each
test runs, we want to instantiate a new Game.
We created a RollMany method to take care of the loop.
At the end of the Normal Game tests, our code looks like this: