Exemplo n.º 1
0
        public void Given_the_player_has_a_score_of_10_and_dealer_has_score_of_12_dealer_wins()
        {
            // Given I have a total of 10
            // And The dealer has a list of cards with a total of 12
            var playerScore = 10;
            var dealerScore = 12;

            // When the I call the win method
            ICheckWinner checkWinner = new CheckWinner();
            string       result      = checkWinner.CheckTheWinnerBetweenPlayerAndDealer(playerScore, dealerScore);

            // Then I should expect the dealer has won
            Assert.AreEqual("Dealer", result);
        }
Exemplo n.º 2
0
        public void Given_the_player_has_a_score_of_21_and_dealer_has_score_of_21_draw()
        {
            // Given I have a total of 21
            // And The dealer has a list of cards with a total of 21
            var playerScore = 21;
            var dealerScore = 21;

            // When the I call the win method
            ICheckWinner checkWinner = new CheckWinner();
            string       result      = checkWinner.CheckTheWinnerBetweenPlayerAndDealer(playerScore, dealerScore);

            // Then I should expect nobody won - 'draw'
            Assert.AreEqual("Draw", result);
        }
Exemplo n.º 3
0
        public void DualGame_Player2_ShouldWin()
        {
            var player1 = new Cricket();
            var player2 = new Cricket();

            player1.Score(4);
            player1.Score(3);
            player1.Score(-1);
            player2.Score(4);
            player2.Score(4);
            player2.Score(-1);
            var win = new CheckWinner(player1, player2);

            Assert.AreEqual(win.Winner, "Player2");
        }
Exemplo n.º 4
0
        public void DualGame_Match_ShouldBeTie()
        {
            var player1 = new Cricket();
            var player2 = new Cricket();

            player1.Score(4);
            player1.Score(3);
            player1.Score(4);
            player1.Score(-1);
            player2.Score(4);
            player2.Score(4);
            player2.Score(3);
            player2.Score(-1);
            var win = new CheckWinner(player1, player2);

            Assert.AreEqual(win.Winner, "Draw");
        }
Exemplo n.º 5
0
        private void Play(int[] coordinate)
        {
            int   x     = coordinate[0];
            int   y     = coordinate[1];
            Point mouse = new Point(x, y);

            if (move == PlayerMove.Player1 &&
                Board.Holders[x, y] == Figures.B)
            {
                figureX.Draw(graphics, mouse);
                Board.Holders[x, y] = Figures.X;
                move = PlayerMove.Player2;
            }
            if (move == PlayerMove.Player2 &&
                Board.Holders[x, y] == Figures.B)
            {
                figureO.Draw(graphics, mouse);
                Board.Holders[x, y] = Figures.O;
                move = PlayerMove.Player1;
            }

            Winner winner = CheckWinner.whoIsWin();

            if (winner == Winner.X)
            {
                MessageBox.Show($"{figureX.Name} {WINNER_TEXT}");
                panel.Click -= panel_Click;
                RestartGame();
            }
            if (winner == Winner.O)
            {
                MessageBox.Show($"{figureO.Name} {WINNER_TEXT}");
                panel.Click -= panel_Click;
                RestartGame();
            }
            if (winner == Winner.Draw)
            {
                MessageBox.Show(DRAW_TEXT);
                panel.Click -= panel_Click;
                RestartGame();
            }
        }
Exemplo n.º 6
0
 public void ThenTheMatchShouldBeTied()
 {
     game = new CheckWinner(_player1, _player2);
     game.Winner.Should().Be("Draw");
 }
Exemplo n.º 7
0
 public void ThenThePlayerScoreShouldWin(int playerNo)
 {
     game = new CheckWinner(_player1, _player2);
     game.Winner.Should().Be("Player" + playerNo);
 }
Exemplo n.º 8
0
        public void CheckingTie()
        {
            var game = new CheckWinner();

            Assert.IsFalse(game.IsTie());
        }
Exemplo n.º 9
0
        public void CheckingWinner()
        {
            var game = new CheckWinner();

            Assert.IsTrue(game.ShowWinner(0));
        }
Exemplo n.º 10
0
 private void Start()
 {
     theSlider = this.GetComponent <Slider>();
     board     = FindObjectOfType <Board>();
     winScript = FindObjectOfType <CheckWinner>();
 }
Exemplo n.º 11
0
 private void Start()
 {
     checkWinner = gameObject.GetComponent <CheckWinner>();
     orbitCamera = FindObjectOfType <OrbitCamera>();
     GenerateBoard();
 }