Пример #1
0
 public void Test1515()
 {
     Game game = new Game();
     game.PlayerOneWinsPoint();
     game.PlayerTwoWinsPoint();
     Assert.AreEqual("15 all", game.Score());
 }
Пример #2
0
 public Controller()
 {
     Game = new Game();
     Player1Name = "Bart";
     Player2Name = "Stefan";
     CreateScoreBoard();
 }
Пример #3
0
 public void Intermezzo_ScoringWhenAWinnerThrows2()
 {
     var game = new Game();
     game.Player1Scores();
     game.Player1Scores();
     game.Player1Scores();
     game.Player1Scores();
     Assert.Throws<InvalidOperationException>(game.Player2Scores);
 }
Пример #4
0
 private void InitializeCurrentGame()
 {
     if (playerTwoGames == playerOneGames && playerOneGames == 6)
         currentGame = new Tiebreak();
     else
         currentGame = new Game();
     currentGame.PlayerOneWins += PlayerOneWinsGame;
     currentGame.PlayerTwoWins += PlayerTwoWinsGame;
 }
Пример #5
0
        public void TestDeuce()
        {
            Game game = new Game();
            for (int i = 0; i < 5; i++)
            {
                game.PlayerOneWinsPoint();
                game.PlayerTwoWinsPoint();
            }

            Assert.AreEqual("deuce", game.Score());
        }
Пример #6
0
        public void Test3030()
        {
            Game game = new Game();
            for (int i = 0; i < 2; i++)
            {
                game.PlayerOneWinsPoint();
                game.PlayerTwoWinsPoint();
            }

            Assert.AreEqual("30 all", game.Score());
        }
Пример #7
0
        public void TestAdvP2()
        {
            Game game = new Game();
            for (int i = 0; i < 3; i++)
            {
                game.PlayerOneWinsPoint();
                game.PlayerTwoWinsPoint();
            }
            game.PlayerTwoWinsPoint();

            Assert.AreEqual("advantage player two", game.Score());
        }
Пример #8
0
 public void Deuce_ScoreDeuce()
 {
     const string expected = "deuce";
     var game = new Game();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     var actual = game.ScoreString;
     Assert.AreEqual(expected, actual);
 }
Пример #9
0
 public void AdvantagePlayer1_ScoreAD_40()
 {
     const string expected = "AD-40";
     var game = new Game();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     var actual = game.ScoreString;
     Assert.AreEqual(expected, actual);
 }
Пример #10
0
 public void SecondAdvantagePlayer2_Score40_AD()
 {
     const string expected = "40-AD";
     var game = new Game();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     var actual = game.ScoreString;
     Assert.AreEqual(expected, actual);
 }
Пример #11
0
 public void Player2LoveGame_Player2Wins()
 {
     const int expected = 2;
     var game = new Game();
     game.Player2Scores();
     game.Player2Scores();
     game.Player2Scores();
     game.Player2Scores();
     var actual = game.Winner;
     Assert.AreEqual(expected, actual);
 }
Пример #12
0
 public void Player2LoveGame_AWinner()
 {
     const bool expected = true;
     var game = new Game();
     game.Player2Scores();
     game.Player2Scores();
     game.Player2Scores();
     game.Player2Scores();
     var actual = game.HasWinner;
     Assert.AreEqual(expected, actual);
 }
Пример #13
0
 public void Player1Scores_Score15_0()
 {
     var game = new Game();
     const string expected = "15-0";
     game.Player1Scores();
     var actual = game.ScoreString;
     Assert.AreEqual(expected, actual);
 }
Пример #14
0
 public void TestTripleGamePoint()
 {
     Game game = new Game();
     for (int i = 0; i < 3; i++)
     {
         game.PlayerOneWinsPoint();
     }
     Assert.AreEqual("40 - love", game.Score());
 }
Пример #15
0
 public void Intermezzo_ThrowWhenRequestingWinnerIfNoWinner()
 {
     var game = new Game();
     Assert.Throws<InvalidOperationException>(() => { var irrelevant = game.Winner; });
 }
Пример #16
0
 public void TestLoveAll()
 {
     Game game = new Game();
     Assert.AreEqual("love all", game.Score());
 }
Пример #17
0
 public void TestGameOver()
 {
     Game game = new Game();
     game.PlayerTwoWinsPoint();
     game.PlayerOneWinsPoint();
     game.PlayerTwoWinsPoint();
     game.PlayerTwoWinsPoint();
     game.PlayerTwoWinsPoint();
     Assert.AreEqual(true, game.GameOver);
 }
Пример #18
0
 public void NewGame_Score0_0()
 {
     const string expected = "0-0";
     var actual = new Game().ScoreString;
     Assert.AreEqual(expected, actual);
 }
Пример #19
0
 public void SetUp()
 {
     m_Game = new Game();
     m_Player1Name = "Timo";
     m_Player2Name = "Stefan";
 }
Пример #20
0
        public void TestP2Wins()
        {
            Game game = new Game();
            for (int i = 0; i < 3; i++)
            {
                game.PlayerOneWinsPoint();
                game.PlayerTwoWinsPoint();
            }
            game.PlayerTwoWinsPoint();
            game.PlayerTwoWinsPoint();

            Assert.AreEqual("player two wins", game.Score());
        }
Пример #21
0
 public void NewGame_NoWinner()
 {
     const bool expected = false;
     var actual = new Game().HasWinner;
     Assert.AreEqual(expected, actual);
 }
Пример #22
0
 public ScoreBoard(Game game, string player1Name, string player2Name)
 {
     m_Game = game;
     m_PlayerNames = new[] {player1Name, player2Name};
 }
Пример #23
0
 public void Player1Advantage_NoWinner()
 {
     const bool expected = false;
     var game = new Game();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     game.Player2Scores();
     game.Player1Scores();
     var actual = game.HasWinner;
     Assert.AreEqual(expected, actual);
 }
Пример #24
0
 public void Player1ScoresThrice_Player2ScoresOnce_Score40_15()
 {
     var game = new Game();
     const string expected = "40-15";
     game.Player1Scores();
     game.Player1Scores();
     game.Player1Scores();
     game.Player2Scores();
     var actual = game.ScoreString;
     Assert.AreEqual(expected, actual);
 }