示例#1
0
        public void Mulligan()
        {
            GameEngine.DealPreMulligan();

            // Mulligan the player's hand completely
            var handCount = player.Hand.Count;

            BaseCard[] originalHand = new BaseCard[handCount];
            player.Hand.CopyTo(originalHand, 0);
            GameEngine.Mulligan(player, originalHand);

            // Verify that the player's hand don't contain the same cards
            Assert.IsFalse(player.Hand.SequenceEqual(originalHand.ToList()), "Verify the hand is new.");
            Assert.AreEqual(Constants.MAX_CARDS_IN_DECK - handCount, player.Deck.Cards.Count, "Verify deck size after mulligan");
            Assert.IsFalse(originalHand.Except(player.Deck.Cards).Any(), "Verify the original cards are back in the deck");
            Assert.IsTrue(GameEngine.PlayerMulliganed, "Verify that the player mulliganed flag is set");

            // For the opponent, choose not to mulligan any cards
            var opponentHandCount = opponent.Hand.Count;

            BaseCard[] opponentOriginalHand = new BaseCard[opponentHandCount];
            opponent.Hand.CopyTo(opponentOriginalHand, 0);
            GameEngine.Mulligan(opponent, null);

            // Verify that the opponent's hand contains the same cards
            Assert.IsFalse(opponentOriginalHand.Except(opponent.Hand).Any(), "Verify the hand has the same cards");
            Assert.IsTrue(GameEngine.OpponentMulliganed, "Verify that the opponent mulliganed flag is set");
        }
示例#2
0
        public void Mulligan()
        {
            GameEngine.DealPreMulligan();

            // Mulligan the player's hand completely
            var handCount = player.Hand.Count;
            BaseCard[] originalHand = new BaseCard[handCount];
            player.Hand.CopyTo(originalHand, 0);
            GameEngine.Mulligan(player, originalHand);

            // Verify that the player's hand don't contain the same cards
            Assert.IsFalse(player.Hand.SequenceEqual(originalHand.ToList()), "Verify the hand is new.");
            Assert.AreEqual(Constants.MAX_CARDS_IN_DECK - handCount, player.Deck.Cards.Count, "Verify deck size after mulligan");
            Assert.IsFalse(originalHand.Except(player.Deck.Cards).Any(), "Verify the original cards are back in the deck");
            Assert.IsTrue(GameEngine.PlayerMulliganed, "Verify that the player mulliganed flag is set");

            // For the opponent, choose not to mulligan any cards
            var opponentHandCount = opponent.Hand.Count;
            BaseCard[] opponentOriginalHand = new BaseCard[opponentHandCount];
            opponent.Hand.CopyTo(opponentOriginalHand, 0);
            GameEngine.Mulligan(opponent, null);

            // Verify that the opponent's hand contains the same cards
            Assert.IsFalse(opponentOriginalHand.Except(opponent.Hand).Any(), "Verify the hand has the same cards");
            Assert.IsTrue(GameEngine.OpponentMulliganed, "Verify that the opponent mulliganed flag is set");
        }