Example #1
0
        public void Shuffle_Basic()
        {
            int maxCard = 30;

            // test
            Deck deck = new Deck(maxCard);

            // confirm all cards accounted for
            var cards       = deck.Cards;
            var cardCounter = new TestCardCounter();

            cardCounter.AddCards(cards.ToList());
            Assert.IsTrue(cardCounter.Validate(maxCard));

            // confirm there was 'shuffling'
            int numMatches    = 0;
            int maxNumMatches = maxCard / 4;

            foreach (var i in Enumerable.Range(1, maxCard - 1))
            {
                int originalValue = i + 1;
                if (cards[i] == originalValue)
                {
                    numMatches++;
                }
            }

            Assert.Less(numMatches, maxNumMatches);
        }
Example #2
0
        public void Deal_Basic()
        {
            var config = new TestConfig();
            var deck   = new Deck(config.GetMaxCard());

            // test
            var result = this.Deal(config, deck);

            var cardCounter = new TestCardCounter();

            cardCounter.AddCards(result);
            Assert.IsTrue(cardCounter.Validate(config.GetMaxCard()));
        }