Beispiel #1
0
        public void TestAddCardIncorrectOrder()
        {
            var card1 = new Card
            {
                Suit  = Card.Suits.Spades,
                Value = Card.Values.Ace
            };

            var card2 = new Card
            {
                Suit  = Card.Suits.Spades,
                Value = Card.Values.Three
            };

            IFoundation foundation = new Foundation(card1.Suit);

            foundation.AddCard(card1);
            bool accepted = foundation.AddCard(card2);

            Assert.IsFalse(accepted);
        }
Beispiel #2
0
        public void TestAddCardFullFoundation()
        {
            var         suit       = Card.Suits.Spades;
            IFoundation foundation = new Foundation(suit);
            Card        card       = null;

            //makes sure all cards are different and fills the deck
            foreach (Card.Values value in Enum.GetValues(typeof(Card.Values)))
            {
                card = new Card
                {
                    Suit  = suit,
                    Value = value
                };
                foundation.AddCard(card);
            }


            bool accepted = foundation.AddCard(card);

            Assert.IsFalse(accepted);
        }
Beispiel #3
0
        public void TestAddCardIncorrectSuit()
        {
            //same as above
            var card = new Card
            {
                Suit  = Card.Suits.Spades,
                Value = Card.Values.Ace
            };
            // same as above, but the IsFalse wants a different card than above
            IFoundation foundation = new Foundation(Card.Suits.Clubs);
            bool        accepted   = foundation.AddCard(card);

            Assert.IsFalse(accepted);
        }
Beispiel #4
0
        public void TestAddCard()
        {
            //this creates a card with value and suit
            var card = new Card
            {
                Suit  = Card.Suits.Spades,
                Value = Card.Values.Ace
            };

            //this adds the card just created to the foundation and makes sure it is valid and accepted
            IFoundation foundation = new Foundation(card.Suit);
            bool        accepted   = foundation.AddCard(card);

            Assert.IsTrue(accepted);
        }