Set-up

In honor of one of my favorite countdowns, Slapsgiving, we will do a modified NASA Countdown, but call it Turkey Countdown for today’s Kata will also include a splash of TDD for extra effort. This make this a longer Kata than normal, but it is a good exercise.

Kata — Is the Turkey Ready yet?

Momma wants to fry the turkey. As the official fryer of the turkey, you are very excited. So excited about this responsibility, you have decide to create an official timer.

The turkey counter will take in a number and count down 0.(example if 11 minutes is entered: 11 10 9 8 7 6 5 4 3 2 1 0)

The way this is made hard, is that you have to follow TDD principles of Red - Green - Refactor.

My Thoughts

This was not a quick Kata. The TDD caused me to need to do some research. The following MSDN walkthroughs were useful:

Test Class Example

This is only my implementation of a Test Class for this Kata. There are numerous other possibilities, but I wanted to give you a reference point.


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TurkeyDayCountdown;

namespace TurkeyDayCountdown.Test
{
    [TestClass]
    public class TurkeyCountdownTest
    {
        [TestMethod]
        public void ReturnUserInputAsStartingPoint()
        {
            //arrange
            int userinput = 5;
            TurkeyCountdown turkeyCountdown = new TurkeyCountdown(userinput);

            //assert
            Assert.AreEqual(userinput, turkeyCountdown._CurrentPoint);
        }

        [TestMethod]
        public void StartingPointToZero()
        {
            //arrange
            int userinput = 5;
            int expectedResults = 0;
            TurkeyCountdown turkeyCountdown = new TurkeyCountdown(userinput);

            //act
            turkeyCountdown.CountDown();

            //assert
            Assert.AreEqual(expectedResults, turkeyCountdown._CurrentPoint);
        }
    }
}