Thursday, March 14, 2013

Brewing beer Kata 1st. draft

I am giving a 15min. lightning talk at @brewww "TypeScript kata: The TDD style" Friday 22. of marts.

And thougt I would make a brewing beer kata to the talk, though I'm not sure the following kata is good enough as a standard Kata, please give comment to improvements. Ill promise to post the final Kata in TypeScript later :-)

First draft of the kata:
  1. Create a simple Brewary with a method IBeer Brew()
    1. The method take 0 parameters but needs to return an IBeer
    2. The Beer should be of type lager
  2. Allow the Brew method to handle a brewingTemperature and a fermentationInDays argument
    1. If brewingTemperature is less than 5 throw exception “Temperature is to low”
    2. If brewingTemperature is greater than 4 and less than 11 return a beer of type lager
    3. If fermentationInDays is less than 7 and greater than 14 throw exception “fermentation for lager beers should be between 7 and 14 days”
  3. Add optional ingredients of type string as “roasted malt” and “barley” to make a stout
    1. If fermentationInDays less than 5 and greater than 6 throw exception “fermentation for stouts beers should be 5 or 6 days”
    2. brewingTemperature not equal 20 throw exception
    3. Expect result to be of type Stout
    4. Expect beers alcohol to be 7percent if fermentationInDays is 5
    5. Expect beers alcohol to be 8percent if fermentationInDays is 6

No comments:

Post a Comment