コード例 #1
0
        public void ShallPlayerWinTheGameWhenSheWinsTheBallAtFourtyAndOtherPlayerHasLessThanFourty()
        {
            var playerA = new Player();
            var playerB = new Player();

            var scorecard = new Scorecard(playerA, playerB);

            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerB);

            Assert.AreEqual("Player B wins", scorecard.GetCurrentGamePoints());
        }
コード例 #2
0
        public void ShallGamePointBeLoveFifteen()
        {
            var playerA = new Player();
            var playerB = new Player();

            var scorecard = new Scorecard(playerA, playerB);

            scorecard.AwardPointToPlayer(playerB);

            Assert.AreEqual("Love - Fifteen", scorecard.GetCurrentGamePoints());
        }
コード例 #3
0
        public void ShallPlayersReturnToDeuceIfOnePlayerLoosesAdvantage()
        {
            var playerA = new Player();
            var playerB = new Player();

            var scorecard = new Scorecard(playerA, playerB);

            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);

            Assert.AreEqual("Deuce", scorecard.GetCurrentGamePoints());
        }
コード例 #4
0
        public void ShallPlayerHaveAdvantageWhenSheWinsTheBallAtFourtyAndOtherPlayerHasFourty()
        {
            var playerA = new Player();
            var playerB = new Player();

            var scorecard = new Scorecard(playerA, playerB);

            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerB);

            Assert.AreEqual("Advantage Player B", scorecard.GetCurrentGamePoints());
        }
コード例 #5
0
        public void BothPlayersAreAtDeuceWhenTheyHaveFourtyPoints()
        {
            var playerA = new Player();
            var playerB = new Player();

            var scorecard = new Scorecard(playerA, playerB);

            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);
            scorecard.AwardPointToPlayer(playerA);
            scorecard.AwardPointToPlayer(playerB);

            Assert.AreEqual("Deuce", scorecard.GetCurrentGamePoints());
        }