Пример #1
0
        public void AddDrawnCardToTheHandTests()
        {
            var hand = new List <ICard>
            {
                new Card {
                    ManaCost = 1
                }, new Card {
                    ManaCost = 2
                },
                new Card {
                    ManaCost = 3
                }, new Card {
                    ManaCost = 4
                }
            };

            var drawnCard = new Card {
                ManaCost = 8
            };

            var playerMock = new Mock <IPlayer>();

            playerMock.SetupGet(player => player.Hand).Returns(hand);

            bool isOverload = _operations.AddDrawnCardToTheHand(playerMock.Object, drawnCard);

            Assert.AreEqual(5, playerMock.Object.Hand.Count);
            Assert.AreEqual(false, isOverload);

            isOverload = _operations.AddDrawnCardToTheHand(playerMock.Object, drawnCard);

            Assert.AreEqual(5, playerMock.Object.Hand.Count);
            Assert.AreEqual(true, isOverload);
        }
Пример #2
0
        /// <summary>
        /// Randomly card draw operations prior to game turn.
        /// </summary>
        private void RandomlyCardDrawOperations()
        {
            ICard drawnCard = _operations.RandomlyDrawOneCardFromPlayerDeck(_activePlayer);

            _io.InfoAboutRandomlyDrawnCardMessage(drawnCard);

            if (drawnCard == null)
            {
                _isGameContinuous = _operations.BleedingOut(_activePlayer);

                if (!_isGameContinuous)
                {
                    _io.YouDefeatedMessage(_activePlayer, _opponentPlayer);
                }

                return;
            }

            bool isOverloadedHand = _operations.AddDrawnCardToTheHand(_activePlayer, drawnCard);

            if (isOverloadedHand)
            {
                _io.RandomlyDrawnCardCouldNotAddedMessage();
            }
        }