Beispiel #1
0
        public void PlayerReturnToDeuceOnAdvantage(Player player)
        {
            TennisGame game = new TennisGame(40, 40);

            game.scores(Opponent(player));

            Assert.AreEqual("Deuce", game.scores(player));
        }
Beispiel #2
0
        public void GiveScoresTheResultShouldBeAsExpected(int score1, int score2, string expected)
        {
            // arrange
            TennisGame game = new TennisGame(score1, score2);

            // action
            Assert.AreEqual(expected, game.display());
        }
Beispiel #3
0
        public void WinOccursAfterChallenge(Player player)
        {
            TennisGame game = new TennisGame(40, 40);

            Assert.AreEqual("Player One Advantage", game.scores(player));
            Assert.AreEqual("Deuce", game.scores(Opponent(player)));
            Assert.AreEqual("Player One Advantage", game.scores(player));

            Assert.AreEqual("Player One Wins", game.scores(player));
        }
Beispiel #4
0
        public void PlayerWinsIfPlayerAlreadyScores40AndOtherPlayerIsNotAt40(Player player, string expected)
        {
            TennisGame game;

            if (player == Player.One)
            {
                game = new TennisGame(40, 0);
            }
            else
            {
                game = new TennisGame(0, 40);
            }

            Assert.AreEqual(expected, game.scores(player));
        }
Beispiel #5
0
        public void PlayerGainAdvantageOnDeuce(Player player, string expected)
        {
            TennisGame game = new TennisGame(40, 40);

            Assert.AreEqual(expected, game.scores(player));
        }
Beispiel #6
0
        public void ScoreShouldIncrementPlayerScore()
        {
            TennisGame game = new TennisGame(0, 0);

            Assert.AreEqual("Fifteen-Love", game.scores(Player.One));
        }