Ejemplo n.º 1
0
 public void Test1515()
 {
     Game game = new Game();
     game.PlayerOneWinsPoint();
     game.PlayerTwoWinsPoint();
     Assert.AreEqual("15 all", game.Score());
 }
Ejemplo n.º 2
0
 public Controller()
 {
     Game = new Game();
     Player1Name = "Bart";
     Player2Name = "Stefan";
     CreateScoreBoard();
 }
Ejemplo n.º 3
0
 public void Intermezzo_ScoringWhenAWinnerThrows2()
 {
     var game = new Game();
     game.Player1Scores();
     game.Player1Scores();
     game.Player1Scores();
     game.Player1Scores();
     Assert.Throws<InvalidOperationException>(game.Player2Scores);
 }
Ejemplo n.º 4
0
 private void InitializeCurrentGame()
 {
     if (playerTwoGames == playerOneGames && playerOneGames == 6)
         currentGame = new Tiebreak();
     else
         currentGame = new Game();
     currentGame.PlayerOneWins += PlayerOneWinsGame;
     currentGame.PlayerTwoWins += PlayerTwoWinsGame;
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 14
0
 public void TestTripleGamePoint()
 {
     Game game = new Game();
     for (int i = 0; i < 3; i++)
     {
         game.PlayerOneWinsPoint();
     }
     Assert.AreEqual("40 - love", game.Score());
 }
Ejemplo n.º 15
0
 public void Intermezzo_ThrowWhenRequestingWinnerIfNoWinner()
 {
     var game = new Game();
     Assert.Throws<InvalidOperationException>(() => { var irrelevant = game.Winner; });
 }
Ejemplo n.º 16
0
 public void TestLoveAll()
 {
     Game game = new Game();
     Assert.AreEqual("love all", game.Score());
 }
Ejemplo n.º 17
0
 public void TestGameOver()
 {
     Game game = new Game();
     game.PlayerTwoWinsPoint();
     game.PlayerOneWinsPoint();
     game.PlayerTwoWinsPoint();
     game.PlayerTwoWinsPoint();
     game.PlayerTwoWinsPoint();
     Assert.AreEqual(true, game.GameOver);
 }
Ejemplo n.º 18
0
 public void NewGame_Score0_0()
 {
     const string expected = "0-0";
     var actual = new Game().ScoreString;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 19
0
 public void SetUp()
 {
     m_Game = new Game();
     m_Player1Name = "Timo";
     m_Player2Name = "Stefan";
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 21
0
 public void NewGame_NoWinner()
 {
     const bool expected = false;
     var actual = new Game().HasWinner;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 22
0
 public ScoreBoard(Game game, string player1Name, string player2Name)
 {
     m_Game = game;
     m_PlayerNames = new[] {player1Name, player2Name};
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }