public void TestSorterWithShuffledDeck()
        {
            var deckToShuffle = CardDeckGenerator.GenerateCardDeck();

            //Note: We have another test that ensures the generator generates a sorted deck of cards, so we can safely use the vanilla output of the
            //generator as a reference
            var deckToCompare = CardDeckGenerator.GenerateCardDeck();

            var shuffledDeck = Shuffler.ShuffleCards(deckToShuffle);

            var sortedDeck = Sorter.SortDeck(shuffledDeck);

            bool differenceFound = false;

            for (int i = 0; i < deckToCompare.Count; i++)
            {
                differenceFound = deckToCompare[i].Id != sortedDeck[i].Id;

                if (differenceFound)
                {
                    break;
                }
            }

            Assert.IsFalse(differenceFound);
        }
        public void TestCardGeneratorBounds()
        {
            var deck = CardDeckGenerator.GenerateCardDeck();

            Assert.AreEqual(11, deck.First().Id);

            Assert.AreEqual(134, deck.Last().Id);
        }
        public void TestShufflerResultLength()
        {
            var deckToShuffle = CardDeckGenerator.GenerateCardDeck();
            var deckToCompare = CardDeckGenerator.GenerateCardDeck();

            var shuffledDeck = Shuffler.ShuffleCards(deckToShuffle);

            Assert.AreEqual(deckToCompare.Count, shuffledDeck.Count);
        }
        public void TestCardGeneratorSort()
        {
            var deck = CardDeckGenerator.GenerateCardDeck();

            for (int i = 0; i < deck.Count; i++)
            {
                //Prevents bounding error
                if (i == 0)
                {
                    continue;
                }

                Assert.IsTrue(deck[i - 1].Id < deck[i].Id);
            }
        }
        public void TestSorterWithInvertedDeck()
        {
            var invertedDeck = CardDeckGenerator.GenerateCardDeck();

            //We're reversing the deck to force the sorter to move every row
            invertedDeck.Reverse();

            var sortedDeck = Sorter.SortDeck(invertedDeck);

            for (int i = 0; i < sortedDeck.Count; i++)
            {
                //Prevents bounding error
                if (i == 0)
                {
                    continue;
                }

                Assert.IsTrue(sortedDeck[i - 1].Id < sortedDeck[i].Id);
            }
        }
        public void TestShufflerCards()
        {
            var deckToShuffle = CardDeckGenerator.GenerateCardDeck();
            var deckToCompare = CardDeckGenerator.GenerateCardDeck();

            //OK, so trying to test nondeterministic methods is deterministically impossible.  With that said,
            //the best solution I can think of at the moment is to shuffle the deck, if it matches with the reference list, shuffle it again.  Repeat that process
            //until the chances of it returning the same deck for all those times is statistically zero.

            var shuffledDeck = Shuffler.ShuffleCards(deckToShuffle);

            bool differenceFound = false;

            for (int tries = 0; tries < 100; tries++)
            {
                //Compare each card with the original
                for (int i = 0; i < deckToCompare.Count; i++)
                {
                    if (deckToCompare[i].Id != deckToShuffle[i].Id)
                    {
                        differenceFound = true;
                        break;
                    }
                }

                //break if a difference is found
                if (differenceFound)
                {
                    break;
                }

                //If a difference is not found, shuffle the cards again
                shuffledDeck = Shuffler.ShuffleCards(shuffledDeck);
            }

            Assert.IsTrue(differenceFound);
        }
        public void TestCardDeckGeneratorLength()
        {
            var deck = CardDeckGenerator.GenerateCardDeck();

            Assert.AreEqual(52, deck.Count);
        }