Example #1
0
        public void Player1HasWon()
        {
            var scorecard = new Scorecard();

            scorecard.PlayerOne.HasWon = true;

            var hasAdvantage = scorecard.GetCurrentGamePoints();

            Assert.AreEqual("Player1 has won", hasAdvantage);
        }
Example #2
0
        public void TestMethod1()
        {
            var scorecard = new Scorecard();

            scorecard.PlayerOne.Points = 15;
            scorecard.PlayerTwo.Points = 30;

            string points = scorecard.GetCurrentGamePoints();

            Assert.AreEqual("15:30", points);
        }
Example #3
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());
        }
Example #4
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());
        }
Example #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());
        }
Example #6
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());
        }
Example #7
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());
        }