public void DealShouldReturnNullWhenNoCardsLeftInDeck() { var deck = new Deck(); for (int i = 0; i < 52; i++) { Card? dealt = deck.Deal(); Assert.That(dealt.HasValue, Is.True); } var card = deck.Deal(); Assert.That(card, Is.Null); }
public void DealShouldRemoveCardFromDeck() { var deck = new Deck(); Card? card = deck.Deal(); Assert.That( deck.Contains(card.Value), Is.False); }
private static void AssertDecksHaveDifferentOrder(Deck first, Deck second) { int mismatches = 0; for (int i = 0; i < 52; i++) { var cardA = first.Deal().Value; var cardB = second.Deal().Value; if (!cardA.Equals(cardB)) mismatches++; } Assert.That(mismatches, Is.AtLeast(2)); }