コード例 #1
0
        public void GetHighestScore_Player1_score_2_Player_score_0()
        {
            AddTwoPlayers(2, 0, "Player1", "Player2");

            var gameScoreboard     = new GameScoreBoard(_firstPlayer, _secondPlayer);
            var highestScorePlayer = gameScoreboard.GetHighestScorePlayer();

            Assert.AreEqual(2, highestScorePlayer.Score);
        }
コード例 #2
0
        private static void GameResultShouldBe(string expected, TennisPlayer _firstPlayer, TennisPlayer _secondPlayer)
        {
            var gameScoreboard = new GameScoreBoard(_firstPlayer, _secondPlayer);

            // act
            var gameResult = gameScoreboard.GetGameResult();

            // assert
            Assert.AreEqual(expected, gameResult);
        }
コード例 #3
0
        public void GetTennisResult_Player1_score_5_Player_score_4_Result_Player1_Deuce2()
        {
            AddTwoPlayers(3, 4, "Player1", "Player2");

            var gameScoreboard = new GameScoreBoard(_firstPlayer, _secondPlayer);

            // Deuce1
            var gameResult = gameScoreboard.GetGameResult();

            _firstPlayer.Score = _firstPlayer.Score + 2;

            // Deuce2
            gameResult = gameScoreboard.GetGameResult();

            // assert
            Assert.AreEqual("Player1 Deuce2", gameResult);
        }