public void NumberOfTimesPlayTurnCalledForPlayer() { var deck = new Deck(); var player = new PlayerSpy(deck, OneHit); var dealer = new Soft17Player(deck); var console = new ConsoleInputOutput(); var blackjack = new BlackJack(new Player[] { player }, console, dealer); blackjack.StartGame(); Assert.AreEqual(1, player.NumberOfTimesTurnPlayed); }
public void EachPlayerPlaysTheirTurn() { var deck = new Deck(); var player1 = new PlayerSpy(deck, NoHits); var player2 = new PlayerSpy(deck, OneHit); var dealer = new Soft17Player(deck); var console = new ConsoleInputOutput(); var blackjack = new BlackJack(new Player[] { player1, player2 }, console, dealer); blackjack.StartGame(); Assert.NotZero(player1.NumberOfTimesTurnPlayed); Assert.NotZero(player2.NumberOfTimesTurnPlayed); }
public void HumanHitsAndBusts() { var player = PlayerSpy.CreateBustedPlayer(); var dealerDeck = new DeckMock(new[] { new Card(CardFace.Jack, Suit.Hearts), new Card(CardFace.Eight, Suit.Spades), }); var dealer = new Soft17Player(dealerDeck); var console = new ConsoleInputOutput(); var blackjack = new BlackJack(new List <Player> { player }, console, dealer); blackjack.StartGame(); Assert.AreEqual(GameStatus.Busted, player.GameStatus); }
public void DealerWins() { var player = PlayerSpy.CreateLosingPlayer(); var dealerDeck = new DeckMock(new[] { new Card(CardFace.Eight, Suit.Hearts), new Card(CardFace.Ten, Suit.Diamonds), new Card(CardFace.Ace, Suit.Hearts), }); var dealer = new Soft17Player(dealerDeck); var console = new ConsoleInputOutput(); var blackjack = new BlackJack(new List <Player> { player }, console, dealer); blackjack.StartGame(); Assert.AreEqual(GameStatus.Won, dealer.GameStatus); }
public void DealerBusts() { var player = PlayerSpy.CreatePlayerHandValue18(); var dealerDeck = new DeckMock(new[] { new Card(CardFace.Jack, Suit.Hearts), new Card(CardFace.Six, Suit.Spades), new Card(CardFace.Nine, Suit.Diamonds), }); var dealer = new Soft17Player(dealerDeck); var console = new ConsoleInputOutput(); var blackjack = new BlackJack(new List <Player> { player }, console, dealer); blackjack.StartGame(); Assert.AreEqual(GameStatus.Busted, dealer.GameStatus); }