public void When_Deck_Is_Cut_With_A_Nonzero_Integer_Should_Have_A_Different_Top_Card()
        {
            var topCard = _sut.Cards.First();

            _sut.Cut(2);

            Assert.AreNotEqual(topCard, _sut.PullTopCard());
        }
示例#2
0
        private static void TestShuffle()
        {
            int[,] cardCounts = new int[13, 4];
            var deckOfCards = new StandardDeckOfCards(new BlackjackCardValueAssigner());
            int runCount    = 100000000;

            for (int i = 0; i < runCount; i++)
            {
                deckOfCards.Shuffle();
                var card = deckOfCards.PullTopCard();
                ++cardCounts[(int)card.Type, (int)card.Suit];
                deckOfCards.Cards.Add(card);
            }

            for (int typeIndex = 0; typeIndex < 13; typeIndex++)
            {
                for (int suitIndex = 0; suitIndex < 4; suitIndex++)
                {
                    decimal cardOdds = (decimal)cardCounts[typeIndex, suitIndex] / (decimal)runCount;
                    Console.WriteLine((CardType)typeIndex + " of " + (CardSuit)suitIndex + ": " + cardOdds.ToString("P3"));
                }
            }
        }