Ejemplo n.º 1
0
        public void TestBust()
        {
            Player player = new Player();
            Dealer dealer = new Dealer();
            Deck deck = new Deck();
            player.AddCard(new Card(Rank.NINE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TEN, Suit.SPADE));
            player.AddCard(new Card(Rank.FIVE, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.CheckScores();

            Console.WriteLine(game.Status);
            Assert.IsTrue(game.Status == GameState.LOSE);
        }
Ejemplo n.º 2
0
        public void TestBust()
        {
            Player player = new Player();
            Dealer dealer = new Dealer();
            Deck   deck   = new Deck();

            player.AddCard(new Card(Rank.NINE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TEN, Suit.SPADE));
            player.AddCard(new Card(Rank.FIVE, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            game.CheckScores();

            Console.WriteLine(game.Status);
            Assert.IsTrue(game.Status == GameState.LOSE);
        }
Ejemplo n.º 3
0
        public void Test5CardsUnder21Win()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();
            player.AddCard(new Card(Rank.TWO, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TWO, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.SPADE));
            player.AddCard(new Card(Rank.FOUR, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.HEART));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.TEN, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.CheckScores();
            Assert.IsTrue(game.Status == GameState.WIN);
        }
Ejemplo n.º 4
0
        public void TestWin21()
        {
            Player player = new Player();
            Deck   deck   = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            player.AddCard(new Card(Rank.ACE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.JACK, Suit.SPADE));

            game.CheckScores();
            game.RestartGame();
            Assert.AreEqual(105, game.Player.Money);
        }
Ejemplo n.º 5
0
        public void TestBetWin()
        {
            Player player = new Player();
            Deck   deck   = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            player.AddCard(new Card(Rank.ACE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.NINE, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            game.Decision = true;
            game.CheckScores();
            game.RestartGame();
            Assert.IsTrue(game.Player.Money == 100);
        }
Ejemplo n.º 6
0
        public void TestLose()
        {
            Player player = new Player();
            Dealer dealer = new Dealer();
            Deck   deck   = new Deck();

            player.AddCard(new Card(Rank.NINE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TEN, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.CLUB));
            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            game.Decision = true;
            game.CheckScores();

            Assert.IsTrue(game.Status == GameState.LOSE);
        }
Ejemplo n.º 7
0
        public void TestBetLose()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            player.AddCard(new Card(Rank.TEN, Suit.DIAMOND));
            player.AddCard(new Card(Rank.FOUR, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            game.Decision = true;
            game.CheckScores();
            game.RestartGame ();

            Assert.IsTrue(game.Player.Money == 80);
        }
Ejemplo n.º 8
0
        public void Test5CardsUnder21Win()
        {
            Player player = new Player();
            Deck   deck   = new Deck();
            Dealer dealer = new Dealer();

            player.AddCard(new Card(Rank.TWO, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TWO, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.SPADE));
            player.AddCard(new Card(Rank.FOUR, Suit.SPADE));
            player.AddCard(new Card(Rank.ACE, Suit.HEART));

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.TEN, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            game.CheckScores();
            Assert.IsTrue(game.Status == GameState.WIN);
        }
Ejemplo n.º 9
0
        public void TestWin21()
        {
            Player player = new Player();
            Deck deck = new Deck();
            Dealer dealer = new Dealer();

            BlackJackGame game = new BlackJackGame(deck, player, dealer);

            dealer.AddCard(new Card(Rank.TEN, Suit.HEART));
            dealer.AddCard(new Card(Rank.EIGHT, Suit.SPADE));

            player.AddCard(new Card(Rank.ACE, Suit.DIAMOND));
            player.AddCard(new Card(Rank.JACK, Suit.SPADE));

            game.CheckScores();
            game.RestartGame();
            Assert.AreEqual(105, game.Player.Money);
        }
Ejemplo n.º 10
0
        public void TestWin()
        {
            Player player = new Player();
            Dealer dealer = new Dealer();
            Deck deck = new Deck();
            player.AddCard(new Card(Rank.TEN, Suit.DIAMOND));
            player.AddCard(new Card(Rank.TEN, Suit.SPADE));

            dealer.AddCard(new Card(Rank.TEN, Suit.CLUB));
            dealer.AddCard(new Card(Rank.NINE, Suit.SPADE));

            BlackJackGame game = new BlackJackGame(deck, player, dealer);
            game.Decision = true;
            game.CheckScores();

            Assert.IsTrue(game.Status == GameState.WIN);
        }