コード例 #1
0
        public void TestDealCard()
        {
            DeckOfCards deck     = new DeckOfCards();
            int         deckSize = 52;

            foreach (Card testCard in this.completeDeck)
            {
                Card c = deck.DealCard();

                Assert.AreEqual(testCard, c);
                Assert.AreEqual(deckSize--, deck.DeckSize());
            }
            Assert.IsTrue(deckSize == 0);

            bool fail = true;

            try
            {
                Card c = deck.DealCard();
            }
            catch (ArgumentOutOfRangeException drop)
            {
                fail = false;
            }
            finally
            {
                Assert.IsFalse(fail);
            }
        }