Exemplo n.º 1
0
        public void ShouldHaveFiveCardsEachForAGameOf13Players()
        {
            var deck        = new ShuffledPokerDeck();
            var cardPlayers = new List <IHand>()
            {
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>()),
                new PokerHand(new List <ICard>())
            };

            var newGame = new PokerGameSimulator(deck.GetNewDeck(), cardPlayers);

            newGame.DealCards();
            int expectedValue = 5;

            Assert.IsTrue(newGame.Hands.TrueForAll(Hand => Hand.Cards.Count == expectedValue));
        }
Exemplo n.º 2
0
        public void EachSuitAppears13TimesInDeck()
        {
            var deck      = new ShuffledPokerDeck();
            var valueList = new List <string>()
            {
                "Heart", "Diamond", "Spade", "Club"
            };

            Assert.IsTrue(valueList.TrueForAll(value => {
                return(deck.GetNewDeck()
                       .FindAll(cardInDeck => cardInDeck.Suit == value).Count == 13);
            }));
        }
Exemplo n.º 3
0
        public void EachValueAppears4TimesInDeck()
        {
            var deck      = new ShuffledPokerDeck();
            var valueList = new List <int>();

            for (int i = 0; i < 13; i++)
            {
                valueList.Add(i);
            }

            Assert.IsTrue(valueList.TrueForAll(value => {
                return(deck.GetNewDeck()
                       .FindAll(cardInDeck => cardInDeck.Value == value).Count == 4);
            }));
        }
Exemplo n.º 4
0
        public void ShouldBeAbleToCreateAUniqueDeckOf52ItemsOfAnyKind()
        {
            var deck = new ShuffledPokerDeck();

            Assert.IsTrue(deck.GetNewDeck().Distinct().Count() == 52);
        }
Exemplo n.º 5
0
        public void ShouldBeAbleToCreateADeckWithThe3OfHearts()
        {
            var deck = new ShuffledPokerDeck();

            Assert.IsTrue(deck.GetNewDeck().Where(card => card.Value == 3 && card.Suit == "Heart").Count() == 1);
        }