Example #1
0
        public void ShuffleDeckTest_ShuffleDeckShouldSucceed()
        {
            List <Card> expectedDeck = TestHelper.CreatedShuffledStandardDeck();

            IDeck deck        = new TestHelper.TestDeck(TestHelper.CreatedSortedStandardDeck());
            Cards actualCards = new Cards(deck, null, null);

            A.CallTo(() => _cards.ShuffleDeck()).Invokes(() => { deck.Deck = TestHelper.CreatedShuffledStandardDeck(); });

            _cards.ShuffleDeck();

            A.CallTo(() => _cards.ShuffleDeck()).MustHaveHappened();
            Assert.AreEqual(expectedDeck.Count, actualCards.DeckOfCards.Deck.Count);

            for (int i = 0; i < expectedDeck.Count; i++)
            {
                Assert.AreEqual(expectedDeck[i].Suit, actualCards.DeckOfCards.Deck[i].Suit);
                Assert.AreEqual(expectedDeck[i].Value, actualCards.DeckOfCards.Deck[i].Value);
            }
        }