TddKata1

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
994 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 20, 2011

No description available.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (fredericALTorres)

  • I started with the test case Calc.Add("1")

    and then I went for Calc.Add("1,2").

    I did not test Calc.Add("1")

  • You made a mistake. You created if numbers="1" return 1 and then You did different test and left the code. You should add test with "2" string next.

  • @RapaFan Can you give me more info, The line of code if numbers="1" return 1;

    will be removed at some point

see all

All Comments (6)

Sign In or Sign Up now to post a comment!
  • @fredericALTorres Agree with RapaFan. You have to first test that Add("1") returns 1, which you hardcode in as a least effort solution. Then you will have to add a test that calls Add("2") which is another single number test case. After that test failes you convert the hardcoded "return 1" with "return int.Parse(numbers)".

  • @fredericALTorres Rapa is right. If you would have done a test with input "2" after your test with input "1" it would have failed. In other words, you never verified that your calculator would work with any one number input besides "1".

    When I did it, I refactored to if String.IsNullOrEmpty return 0, otherwise, return the int value of the string so I didn't test the input of "2", but the way you did it makes me wonder if I should've tested that. I still think not, but an interesting thought.

  • @fredericALTorres Yeah I noticed You removed it in the end. But that would be my next test. Calc.Add("1") then Calc.Add("2"). How You did it made this line last very long but You knew from the beggining that it will be removed later. Why not do it in next test?

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more