Exemple #1
0
        public void offer_to_split_on_ineligible_hand_returns_false()
        {
            // Arrange
            var player = new BlackjackPlayer();
            var dealerFaceUpCard = Substitute.For<IBlackjackCard>();

            var card1 = Substitute.For<IBlackjackCard>();
            var card2 = Substitute.For<IBlackjackCard>();
            var cards = new List<IBlackjackCard> { card1, card2 };

            var hand1 = Substitute.For<IPlayerHand>();
            hand1.EligibleForSplit.Returns(false);

            var playerHands = (List<IPlayerHand>)player.Hands;
            playerHands.Add(hand1);

            // Act
            var response = player.OfferSplit(dealerFaceUpCard);

            // Assert
            response.Should().Be.False();
        }
Exemple #2
0
        public void offer_to_split_on_eligible_hand_results_in_two_hands()
        {
            // Arrange
            var player = new BlackjackPlayer();
            var dealerFaceUpCard = Substitute.For<IBlackjackCard>();

            var card1 = Substitute.For<IBlackjackCard>();
            var card2 = Substitute.For<IBlackjackCard>();
            var cards = new List<IBlackjackCard> {card1, card2};

            var hand1 = Substitute.For<IPlayerHand>();
            hand1.EligibleForSplit.Returns(true);
            hand1.GetCards().Returns(cards);

            var playerHands = (List<IPlayerHand>) player.Hands;

            playerHands.Add(hand1);

            // Act
            player.OfferSplit(dealerFaceUpCard);

            // Assert
            var actualHands = player.Hands.ToList();

            actualHands.Should().Not.Be.Null();
            actualHands.Count.Should().Equal(2);

            hand1.ReceivedWithAnyArgs().SplitInto(hand1);
        }