Exemple #1
0
        public void TestEmptyDeckDealCards()
        {
            //Initialise variables
            Deck   d  = new Deck();
            Player p1 = new Player();

            bool success = d.DealCard(p1, 53);

            Assert.AreEqual(52, p1._hand.Count);
            Assert.AreEqual(0, d._deck.Count);
            Assert.IsFalse(success);
        }
Exemple #2
0
        public void TestDealCards()
        {
            //Initialise variables
            Deck   d  = new Deck();
            Player p1 = new Player();
            Player p2 = new Player();

            List <Player> pList = new List <Player>();

            pList.Add(p1);
            pList.Add(p2);

            //Deal 2 cards to each player
            foreach (Player p in pList)
            {
                d.DealCard(p, 2);
            }

            //Assert 2 cards are in each player's hand
            Assert.AreEqual(2, p1._hand.Count);
            Assert.AreEqual(2, p2._hand.Count);
            //Assert 4 cards have been removed from deck
            Assert.AreEqual(48, d._deck.Count);
        }