Пример #1
0
        public void Blackjack_DealearStatusToString_OutputsBustIfDealerHasBusted()
        {
            Blackjack blackjack = new Blackjack();

            blackjack.ResetGame();
            //hand at 22
            List <Card> cards = new List <Card> {
                new Card(CardRank.JACK, CardSuit.CLUB), new Card(CardRank.TEN, CardSuit.SPADE), new Card(CardRank.THREE, CardSuit.HEART)
            };

            blackjack.Dealer.Hand = new Hand(cards);

            string expected = "\nDealer is at Bust!";

            expected += $"\nwith the hand ['JACK', 'CLUB'], [10, 'SPADE'], [3, 'HEART']";

            string actual = blackjack.DealerStatusToString();

            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void Blackjack_DealearStatusToString_OutputsBlackjackIfHandIsBlackjack()
        {
            Blackjack blackjack = new Blackjack();

            blackjack.ResetGame();
            //hand at 22
            List <Card> cards = new List <Card> {
                new Card(CardRank.QUEEN, CardSuit.SPADE), new Card(CardRank.ACE, CardSuit.HEART)
            };

            blackjack.Dealer.Hand = new Hand(cards);

            string expected = "\nDealer is at Blackjack!";

            expected += $"\nwith the hand ['QUEEN', 'SPADE'], ['ACE', 'HEART']";

            string actual = blackjack.DealerStatusToString();

            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void Blackjack_DealearStatusToString_OutputsHandIfDealerHasNotBusted()
        {
            Blackjack blackjack = new Blackjack();

            blackjack.ResetGame();

            List <Card> cards = new List <Card> {
                new Card(CardRank.FOUR, CardSuit.SPADE), new Card(CardRank.ACE, CardSuit.CLUB)
            };

            blackjack.Dealer.Hand = new Hand(cards);

            string expected = $"\nDealer is at 15";

            expected += $"\nwith the hand [4, 'SPADE'], ['ACE', 'CLUB']";

            string actual = blackjack.DealerStatusToString();

            Assert.Equal(expected, actual);
        }
Пример #4
0
        public void Blackjack_DealearStatusToString_OutputsDealerStaysIfHandGreaterThan16AndNotBustOrBlackjack()
        {
            Blackjack blackjack = new Blackjack();

            blackjack.ResetGame();
            //hand at 22
            List <Card> cards = new List <Card> {
                new Card(CardRank.SIX, CardSuit.HEART), new Card(CardRank.ACE, CardSuit.SPADE)
            };

            blackjack.Dealer.Hand = new Hand(cards);

            string expected = "\nDealer is at 17";

            expected += $"\nwith the hand [6, 'HEART'], ['ACE', 'SPADE']";
            expected += "\n\nDealer stays";

            string actual = blackjack.DealerStatusToString();

            Assert.Equal(expected, actual);
        }