Exemplo n.º 1
0
        public void HumanWinsWithBlackJackEnum()
        {
            var dealerCards = new DeckMock(new[]
            {
                new Card(CardFace.Eight, Suit.Hearts),
                new Card(CardFace.Ten, Suit.Diamonds),
            });

            var playerCards = new DeckMock(new[]
            {
                new Card(CardFace.Ace, Suit.Hearts),
                new Card(CardFace.Jack, Suit.Diamonds),
            });
            var playerResponse = new TestResponder(new []
            {
                StayResponse,
            });
            var player       = new Human(playerCards, playerResponse);
            var soft17Player = new Soft17Player(dealerCards);
            var console      = new ConsoleInputOutput();
            var blackjack    = new BlackJack(new List <Player> {
                player
            }, console, soft17Player);

            blackjack.StartGame();

            Assert.Equal(GameStatus.BlackJack, player.GameStatus);
        }
        public void CanStayWithTwoCards()
        {
            var testDeck = new DeckMock(new[]
            {
                new Card(CardFace.Ten, Suit.Clubs),
                new Card(CardFace.Ten, Suit.Diamonds),
                new Card(CardFace.Five, Suit.Clubs),
            });
            var testQuestionResponse = new TestResponder(StayInput); //put in () "0"
            var human = new Human(testDeck, testQuestionResponse);

            human.NewHand();
            human.PlayTurn();

            Assert.Equal(20, human.HandValue());
        }
        public void CanHitAt20()
        {
            var testDeck = new DeckMock(new[]
            {
                new Card(CardFace.Ten, Suit.Clubs),
                new Card(CardFace.Ten, Suit.Diamonds),
                new Card(CardFace.Five, Suit.Clubs),
            });
            var testQuestionResponse = new TestResponder(HitInput);
            var human = new Human(testDeck, testQuestionResponse);

            human.NewHand();
            human.PlayTurn();

            Assert.Equal(25, human.HandValue());
        }
        public void StartsWithTwoCards()
        {
            //Given
            var testDeck = new DeckMock((new []
            {
                new Card(CardFace.Eight, Suit.Clubs),
                new Card(CardFace.Eight, Suit.Diamonds),
                new Card(CardFace.Five, Suit.Clubs),
            }));
            var testQuestionResponse = new TestResponder(StayInput);
            var human = new Human(testDeck, testQuestionResponse);

            human.NewHand();

            //When

            //Then
            Assert.Equal(16, human.HandValue());
        }