public void add_card_to_hand() { IPlayer player = new ComputerPlayer(); Card card = new Card(Suit.Clubs, Rank.Ace); player.GetHand().AddCard(card); Assert.AreEqual(1, player.GetHand().Size()); }
public void next_action_busted_because_total_is_greater_than_21() { IPlayer player = new ComputerPlayer(); Hand dealerHand = new Hand(); Card card0 = new Card(Suit.Spades, Rank.King); dealerHand.AddCard(card0); Card card1 = new Card(Suit.Clubs, Rank.King); Card card2 = new Card(Suit.Clubs, Rank.Seven); Card card3 = new Card(Suit.Clubs, Rank.Five); player.GetHand().AddCard(card1); player.GetHand().AddCard(card2); player.GetHand().AddCard(card3); PlayerAction action = player.NextAction(dealerHand); Assert.AreEqual(PlayerAction.Busted, action); }
public void next_action_stand_because_score_greater_or_equal_than_probable_dealers_score() { IPlayer player = new ComputerPlayer(); Hand dealerHand = new Hand(); Card dealerCard1 = new Card(Suit.Spades, Rank.Eight); dealerCard1.Visible = false; Card dealerCard2 = new Card(Suit.Hearts, Rank.Seven); dealerHand.AddCard(dealerCard1); dealerHand.AddCard(dealerCard2); Card playerCard1 = new Card(Suit.Clubs, Rank.King); Card playerCard2 = new Card(Suit.Diamonds, Rank.Eight); player.GetHand().AddCard(playerCard1); player.GetHand().AddCard(playerCard2); PlayerAction action = player.NextAction(dealerHand); Assert.AreEqual(PlayerAction.Stand, action); }