Exemplo n.º 1
0
        public void shuffleTest1()
        {
            // Allocate a deck of cards
            cardDeck deck = new cardDeck();

            // Shuffle
            deck.shuffle();

            // Use the validate method to see if all of the cards are in place
            Assert.IsTrue(deck.validateDeck());
        }
Exemplo n.º 2
0
        public void sortTest1()
        {
            // Allocate a deck of cards
            cardDeck d = new cardDeck();

            // The deck of cards is sorted by default.
            // Shuffle the cards manually
            card c = new card();
            for (int i = 0; i < 51; i++)
            {
                int idx = (r.Next()) % 52;
                c = d.deck[idx];
                d.deck[idx] = d.deck[i];
                d.deck[i] = c;
            }

            // Sort the cards
            d.sort();

            // Use the validate method to see if all of the cards are in place
            Assert.IsTrue(d.validateDeck());
        }