Beispiel #1
0
        public void placeASecondCardOnThePile()
        {
            Piles pile = new Piles();

            pile.addCardToPile(new Card((CardSuite)1, (CardValue)1), (PlayablePiles)0);
            pile.addCardToPile(new Card((CardSuite)1, (CardValue)2), (PlayablePiles)0);

            Assert.AreEqual(2, pile.PlayPiles[0].Count);
        }
Beispiel #2
0
        public void cannotPlaceASecondCardOnThePile()
        {
            void addCardWithWrongPile()
            {
                Piles piles = new Piles();

                piles.addCardToPile(new Card((CardSuite)2, (CardValue)1), (PlayablePiles)1);
                piles.addCardToPile(new Card((CardSuite)2, (CardValue)5), (PlayablePiles)1);
            }

            Assert.Throws(typeof(InvalidCardValueSizeDifferenceException), addCardWithWrongPile);
        }
Beispiel #3
0
        public void addACardToThePlayPile()
        {
            Piles pile = new Piles();

            pile.addCardToPile(new Card((CardSuite)1, (CardValue)1), (PlayablePiles)0);

            Assert.AreEqual(1, pile.PlayPiles[0].Count);
        }
Beispiel #4
0
        public void pileDoesNotHaveKing()
        {
            Piles pile = new Piles();

            for (var i = 1; i <= 12; i++)
            {
                pile.addCardToPile(new Card((CardSuite)1, (CardValue)i), (PlayablePiles)0);
            }

            Assert.False(pile.checkIfAnyPileHasAKing());
        }
Beispiel #5
0
        public void isNotAnAce()
        {
            void addCardWithWrongPile()
            {
                Piles piles = new Piles();

                piles.addCardToPile(new Card((CardSuite)2, (CardValue)3), (PlayablePiles)1);
            }

            Assert.Throws(typeof(MustBeAnAceException), addCardWithWrongPile);
        }
Beispiel #6
0
        public void invalidPileForCardToAdd()
        {
            void addCardWithWrongPile()
            {
                Piles piles = new Piles();

                piles.addCardToPile(new Card((CardSuite)1, (CardValue)1), (PlayablePiles)88);
            }

            Assert.Throws(typeof(InvalidPlayPileException), addCardWithWrongPile);
        }
Beispiel #7
0
        public void returnNullForPileWithKing()
        {
            Piles pile = new Piles();

            for (var i = 1; i <= 12; i++)
            {
                pile.addCardToPile(new Card((CardSuite)1, (CardValue)i), (PlayablePiles)0);
            }

            DiscardPile dp          = new DiscardPile();
            DiscardPile discardPile = pile.getPileWithAKing(dp);

            Assert.IsNull(discardPile);
            Assert.False(dp.DiscardedCards.Any());
        }
Beispiel #8
0
        public void getDiscardPileWithAKing()
        {
            Piles pile = new Piles();

            for (var i = 1; i <= 13; i++)
            {
                pile.addCardToPile(new Card((CardSuite)1, (CardValue)i), (PlayablePiles)0);
            }

            DiscardPile dp          = new DiscardPile();
            DiscardPile discardPile = pile.getPileWithAKing(dp);

            Assert.IsNotNull(discardPile);
            Assert.AreEqual(13, discardPile.DiscardedCards.Count);
        }