public void PlayHand_Deal_DealerHasOneVisibleCard() { // Arrange var cards = new List <Card>() { new Card(CardSuit.Clubs, 4, CardType.Number), new Card(CardSuit.Clubs, 5, CardType.Number), new Card(CardSuit.Clubs, 6, CardType.Number) }; var dealer = new Dealer(); var table = new Table(dealer) { Dealer = dealer }; var playHand = new PlayHand(); playHand.Init(cards, table); // Act playHand.Deal(); // Assert Assert.Single(dealer.Hand.Cards.Where(a => a.Visible)); }
public void PlaySingleHand_1Player_PlayerDraws_Bust() { // Arrange var dealer = new Dealer(); var table = new Table(dealer); var shoe = new Shoe(4); var playHand = new PlayHand(); playHand.Init(shoe.Cards, table); var blackJackStrategy = new BlackJackStrategy() { StrategyItems = new List <BlackJackStrategyItem>() { new BlackJackStrategyItem() { DealerCard = new Card(CardSuit.Spades, 3, CardType.Number), PlayerTotalCardValue = 6, Action = PlayerAction.TakeCard }, new BlackJackStrategyItem() { DealerCard = new Card(CardSuit.Spades, 3, CardType.Number), PlayerTotalCardValue = 12, Action = PlayerAction.TakeCard }, new BlackJackStrategyItem() { DealerCard = new Card(CardSuit.Spades, 3, CardType.Number), PlayerTotalCardValue = 19, Action = PlayerAction.TakeCard } } }; var player = new Player() { Money = 100, Strategy = blackJackStrategy }; // Act table.SitPlayer(player); playHand.PlayerAnte(player, 10); playHand.Deal(); while (playHand.GameInProgress) { playHand.Play(); } playHand.Payout(); // Assert Assert.Equal(90, player.Money); Assert.True(player.Hand.Cards.AddUp() > 21); }
public void PlayHand_Deal_GameInProgress() { // Arrange var cards = new List <Card>() { new Card(CardSuit.Clubs, 4, CardType.Number), new Card(CardSuit.Clubs, 5, CardType.Number) }; var dealer = new Dealer(); var table = new Table(dealer) { Dealer = dealer }; var playHand = new PlayHand(); playHand.Init(cards, table); // Act playHand.Deal(); // Assert Assert.True(playHand.GameInProgress); }