Exemplo n.º 1
0
        public void PlayerHasAdvantage()
        {
            var scorecard = new Scorecard();
            scorecard.PlayerOne.HasAdvantage = true;

            var hasAdvantage = scorecard.GetCurrentGamePoints();

            Assert.AreEqual("Player1 has advantage", hasAdvantage);
        }
Exemplo n.º 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());
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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());
        }
Exemplo n.º 5
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());
        }
Exemplo n.º 6
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());
        }
Exemplo n.º 7
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());
        }