Ejemplo n.º 1
0
        public void Can_Shuffle_Cards()
        {
            var sut = new StandardDeck();

            sut.Shuffle(100);

            All_Cards_Are_Unique();

            Assert.AreEqual(52, sut.Cards.Count);
        }
    public void ShuffleTestForFullDeck()
    {
        HashSet <string> allStates = new HashSet <string>();
        var objectUnderTest        = new StandardDeck().Cards;
        var initialState           = CardPileRepresentation(objectUnderTest);

        allStates.Add(initialState);
        int numberOfShuffles = 1000;

        for (int i = 0; i < numberOfShuffles; i++)
        {
            objectUnderTest.Shuffle();
            allStates.Add(CardPileRepresentation(objectUnderTest));
        }

        //make sure that we never ever see the deck in a state we've seen before after we shuffle
        Assert.True(allStates.Count == numberOfShuffles + 1);
    }