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.AreEqual(GameStatus.BlackJack, player.GameStatus); }
public void StartsWithTwoCards() { var testDeck = new DeckMock(new[] { new Card(CardFace.Five, Suit.Hearts), new Card(CardFace.Five, Suit.Spades), }); var hard17Player = new Hard17Player(testDeck); Assert.AreEqual(10, hard17Player.HandValue()); }
public void StaysOn17() { var testDeck = new DeckMock(new[] { new Card(CardFace.Ten, Suit.Hearts), new Card(CardFace.Seven, Suit.Spades), new Card(CardFace.Jack, Suit.Diamonds), }); var soft17Player = new Soft17Player(testDeck); soft17Player.PlayTurn(); Assert.AreEqual(17, soft17Player.HandValue()); }
public void StartsWithTwoCards() { var testDeck = new DeckMock(new[] { new Card(CardFace.Five, Suit.Hearts), new Card(CardFace.Five, Suit.Spades), new Card(CardFace.Eight, Suit.Clubs), }); var soft17Player = new Soft17Player(testDeck); soft17Player.NewHand(); Assert.AreEqual(10, soft17Player.HandValue()); }
public void HitsUnder17() { var testDeck = new DeckMock(new[] { new Card(CardFace.Ten, Suit.Hearts), new Card(CardFace.Six, Suit.Spades), new Card(CardFace.Ten, Suit.Diamonds), }); var soft17Player = new Soft17Player(testDeck); soft17Player.PlayTurn(); Assert.AreEqual(26, soft17Player.HandValue()); }
public void HitsOn17() { var testDeck = new DeckMock(new[] { new Card(CardFace.Ten, Suit.Hearts), new Card(CardFace.Seven, Suit.Spades), new Card(CardFace.Jack, Suit.Diamonds), }); var hard17Player = new Hard17Player(testDeck); hard17Player.PlayTurn(); Assert.AreEqual(27, hard17Player.HandValue()); }
public void AceCanBeEleven() { var testDeck = new DeckMock(new[] { new Card(CardFace.Jack, Suit.Clubs), new Card(CardFace.Ace, Suit.Diamonds), }); var player = new PlayerImplementation(testDeck); player.PlayTurn(); player.PlayTurn(); Assert.AreEqual(21, player.HandValue()); }
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.AreEqual(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.AreEqual(25, human.HandValue()); }
public void AceChangesValue() { var testDeck = new DeckMock(new[] { new Card(CardFace.Ace, Suit.Clubs), new Card(CardFace.Ace, Suit.Diamonds), new Card(CardFace.Five, Suit.Hearts), new Card(CardFace.Five, Suit.Hearts), }); var player = new PlayerImplementation(testDeck); player.PlayTurn(); player.PlayTurn(); Assert.AreEqual(12, player.HandValue()); }
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 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.AreEqual(16, human.HandValue()); }
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); }