Created
May 13, 2014 17:37
-
-
Save k0stya/43ed5438cb8673a0c529 to your computer and use it in GitHub Desktop.
Tennis kata bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NUnit.Framework; | |
namespace TennisKataBootstrap | |
{ | |
[TestFixture] | |
public class GameScorer_Tests | |
{ | |
[Test] | |
public void Score_should_return_love_love_when_players_have_played() | |
{ | |
// Arrange | |
GameScorer scorer = new GameScorer(); | |
// Act | |
string score = scorer.Score(); | |
// Assert | |
Assert.AreEqual("Love - Love", score); | |
} | |
[Test] | |
public void Score_should_return_fifteen_love_when_first_playered_scored_one_ball() | |
{ | |
// Arrange | |
GameScorer scorer = new GameScorer(); | |
// Act | |
scorer.Player1Scores(); | |
string score = scorer.Score(); | |
// Assert | |
Assert.AreEqual("Fifteen - Love", score); | |
} | |
} | |
public class GameScorer | |
{ | |
private int _firstPlayerScore; | |
public string Score() | |
{ | |
if (_firstPlayerScore == 1) | |
return "Fifteen - Love"; | |
return "Love - Love"; | |
} | |
public void Player1Scores() | |
{ | |
_firstPlayerScore++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment