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

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

            A.CallTo(() => _cards.SortDeck()).Invokes(() => { deck.Deck = TestHelper.CreatedSortedStandardDeck(); });

            _cards.SortDeck();
            A.CallTo(() => _cards.SortDeck()).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);
            }
        }