public void Shuffle_And_Deal_Returns_Different_Card() { IDeck deck = new Deck(); IShuffleCard shuffleCard = new ShuffleCard(deck); deck = shuffleCard.Shuffle(); ICardDealer cardDealer = new CardDealer(deck); Card first = cardDealer.Deal(); Card second = cardDealer.Deal(); Assert.That(first, Is.Not.EqualTo(second)); }
private void redeal(Suit suit) { Card[] randCards = _cardDealer.Deal(_cards.Count, suit); for (int c = 0; c < _cards.Count; c++) { _cards[c].FrontImage.sprite = CardSprites.Get(randCards[c].Value, suit); } }
public void CannotDealNegativeCards() { var cardDealer = new CardDealer(); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-1, Suit.Clubs)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-1, Suit.Spades)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-1, Suit.Hearts)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-1, Suit.Diamonds)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-5, Suit.Clubs)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-5, Suit.Spades)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-5, Suit.Hearts)); Assert.Throws <ArgumentOutOfRangeException>(() => cardDealer.Deal(-5, Suit.Diamonds)); }
private void testDeal(CardDealer cardDealer, int numCards) { var suits = Enum.GetValues(typeof(Suit)).Cast <Suit>(); foreach (Suit suit in suits) { Card[] cards = cardDealer.Deal(numCards, suit); Assert.That(cards.Length, Is.EqualTo(numCards)); for (int c = 0; c < numCards; ++c) { Assert.That(cards[c].Suit, Is.EqualTo(suit)); } } }
[Test] public void Test_Deal_Decreases_Deck_Size() { IDeck deck = new Deck(); IShuffleCard shuffleCard = new ShuffleCard(deck); deck = shuffleCard.Shuffle(); ICardDealer cardDealer = new CardDealer(deck); Card first = cardDealer.Deal(); Assert.That(cardDealer.CardsRemaining(), Is.EqualTo(51)); }
public int PlayGame() { _dealer.Shuffle(); for (var i = 0; i < PlayersCount; i++) { _hands[i] = _dealer.Deal(_handSize).ToList(); _players[i].Deal(_hands[i].AsReadOnly()); } for (var i = 0; i < _handSize; i++) { var foldResult = PlayFold(i); _scores[foldResult.Winner]++; } return(_scores.IndexOf(_scores.Max())); }
public void Deal_All_Cards() { IDeck deck = new Deck(); IShuffleCard shuffleCard = new ShuffleCard(deck); deck = shuffleCard.Shuffle(); ICardDealer cardDealer = new CardDealer(deck); int cardsLeft = deck.Cards.Length; while (cardsLeft > 0) { Card card = cardDealer.Deal(); cardsLeft--; Assert.That(cardsLeft, Is.EqualTo(cardDealer.CardsRemaining())); } }