This week we are going to do another TDD Code Kata which will actually build on the previous TDD String Calculator. So if you didn't do that Code Kata go do that one first and then you can do this one. According to Roy Osherove this one will take a little more time than the last one. Just like last time hopefully if you are a TDD expert this will still be fun for you or at least you might learn something new.
###Task
- This builds on the previous code kata.
- It is supposed to be a continuation of learning how to do TDD with unit tests and mocks.
- Don't forget that a good test name will help you stay on track for you test so you don't mock too much and test enough.
- Test name should contain three main parts (according to Roy):
- What's being tested
- Under what conditions
- What should the expected behavior be under those conditions
###Steps
- Everytime you call Add(string) it also outputs the number result of the calculation in a new line to the terminal or console. (remember to try and do this test first!)
- Create a program (test first)that uses string calculator, which the user can invoke through the terminal/console by calling “scalc ‘1,2,3’” and will output the following line before exiting: “The result is 6”
- Instead of exiting after the first result, the program will ask the user for “another input please” and print the result of the new user input out as well, until the user gives no input and just preses enter. in that case it will exit.
###Reference Thanks to Roy Osherove's website for this Code Kata. His website is a good resource to learn how to do TDD and unit tests. Also his website is a good place to go if this code kata or the previous one from last time is giving you trouble. He has answers on how to solve them on his website if you need some help.
- Fork this github repository.
- Write your solution to the problem.
- Commit your solution to the repository.
- Post a link to your fork as a comment to this TDD String Calculator Part 2 post on codekata.co.