Esempio n. 1
0
        public void TheCardShouldNoLongerBeInThePackAfterACardIsRemoved()
        {
            IPackOfCardsCreator packOfCardsCreator = new PackOfCardsCreator();
            IPackOfCards        packOfCards        = packOfCardsCreator.Create();

            ICard cardRemoved = packOfCards.TakeCardFromTopOfPack();

            CollectionAssert.DoesNotContain(packOfCards, cardRemoved);
        }
Esempio n. 2
0
        public void TheCardsShouldAllBeUniqueAfterTheShuffle()
        {
            IPackOfCardsCreator packOfCardsCreator = new PackOfCardsCreator();
            IPackOfCards        packOfCards        = packOfCardsCreator.Create();

            packOfCards.Shuffle();

            CollectionAssert.AllItemsAreUnique(packOfCards);
        }
Esempio n. 3
0
        public void ThePackOfCardsShouldContain52CardsWhenCreated()
        {
            IPackOfCardsCreator packOfCardsCreator    = new PackOfCardsCreator();
            IPackOfCards        packOfCards           = packOfCardsCreator.Create();
            const int           expectedNumberOfCards = 52;
            int numberOfCards = packOfCards.Count;

            Assert.AreEqual(expectedNumberOfCards, numberOfCards);
        }
Esempio n. 4
0
        public void ThePackOfCardsShouldContainTheSameNumberOfCardsWhenShuffled()
        {
            IPackOfCardsCreator packOfCardsCreator = new PackOfCardsCreator();
            IPackOfCards        packOfCards        = packOfCardsCreator.Create();
            int expectedCount = packOfCards.Count;

            packOfCards.Shuffle();

            int resultCount = packOfCards.Count;

            Assert.AreEqual(expectedCount, resultCount);
        }
Esempio n. 5
0
        public void TheCountOfThePackShouldDecreaseByOneAfterACardIsTakenFromTheTop()
        {
            IPackOfCardsCreator packOfCardsCreator = new PackOfCardsCreator();
            IPackOfCards        packOfCards        = packOfCardsCreator.Create();
            int countBeforeTheCardIsRemoved        = packOfCards.Count;
            int expectedCountAfterCut = countBeforeTheCardIsRemoved - 1;

            ICard card = packOfCards.TakeCardFromTopOfPack();

            int countResult = packOfCards.Count;

            Assert.AreEqual(expectedCountAfterCut, countResult);
        }
Esempio n. 6
0
        public void ShufflingTwiceShouldProduceDifferentCardSequences()
        {
            IPackOfCardsCreator packOfCardsCreator = new PackOfCardsCreator();
            IPackOfCards        packOfCards        = packOfCardsCreator.Create();

            packOfCards.Shuffle();
            IList <ICard> shuffle1Sequence = packOfCards.ToList();

            packOfCards.Shuffle();
            IList <ICard> shuffle2Sequence = packOfCards.ToList();

            Assert.AreNotSame(shuffle1Sequence, shuffle2Sequence);
        }
        static void Main(string[] args)
        {
            IPackOfCardsCreator instance = new PackOfCardsCreator();
            var packOfCards      = instance.Create();
            var firstCardDetails = packOfCards.Select(x => new { x.Suit, x.Value }).FirstOrDefault();

            Console.WriteLine(firstCardDetails);
            packOfCards.Shuffle();

            var firstCardAfterShuffle = packOfCards.Select(x => new { x.Suit, x.Value }).FirstOrDefault();

            Console.WriteLine(firstCardAfterShuffle);

            packOfCards.TakeCardFromTopOfPack();
            var firstCardAfterTakingCardFromTop = packOfCards.Select(x => new { x.Suit, x.Value }).FirstOrDefault();

            Console.WriteLine(firstCardAfterTakingCardFromTop);
            Console.ReadLine();
        }
Esempio n. 8
0
 public void Setup()
 {
     cardsCreator = new PackOfCardsCreator();
 }