Пример #1
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();
            }
        }
Пример #2
0
        public void RandomlyDrawOneCardFromPlayerDeckTests()
        {
            var playerMock = new Mock <IPlayer>();

            var playerDeck = new Deck();

            playerMock.Setup(player => player.Deck).Returns(playerDeck);

            ICard drawnCard = _operations.RandomlyDrawOneCardFromPlayerDeck(playerMock.Object);

            Assert.AreEqual(false, playerDeck.Cards.Any(card => card == drawnCard));

            playerDeck.Cards.Clear();

            drawnCard = _operations.RandomlyDrawOneCardFromPlayerDeck(playerMock.Object);

            Assert.AreEqual(null, drawnCard);
        }