public void Deck_ShuffleRandomizesCards() { Deck deck = new Deck(); var beforeShuffle = deck.RemainingCards; deck.Shuffle(); Assert.IsFalse(beforeShuffle.SequenceEqual(deck.RemainingCards)); }
public void Deck_CanDrawMultipleCards() { Deck deck = new Deck(); var cards = deck.Draw(3); Assert.AreEqual(3, cards.Count()); Assert.IsTrue(cards.All(card => card != null)); }
/// <summary> /// Initializes a new instance of the <see cref="SolitaireBoard"/> class. /// </summary> public SolitaireBoard() { _mainDeck = new Deck(); _mainDeck.Shuffle(); _gamePiles = new FixedSizeStack<Card>[7]; for (int i = 0; i < _gamePiles.Length; i++) { var pile = new FixedSizeStack<Card>(i + 1); for (int j = 0; j < i + 1; j++) { pile.Push(_mainDeck.Draw()); } _gamePiles[i] = pile; } _suitPiles = new FixedSizeStack<Card>[4]; for (int i = 0; i < _suitPiles.Length; i++) { _suitPiles[i] = new FixedSizeStack<Card>(13); } }
public void Deck_ValidObjectIsConstructed() { Deck deck = new Deck(); Assert.AreEqual(52, deck.NumberOfCardsLeft); }
public void Deck_CanDrawSingleCard() { Deck deck = new Deck(); Assert.IsNotNull(deck.Draw()); }