Exemple #1
0
        public void AddCardFromAllPlayersToPot_TwoPlayers_ShouldRemoveTopCardFromBothPlayers()
        {
            var player1 = new Player("Tester1")
            {
                Deck = new List <Card>()
                {
                    new Card(Suit.Clubs, Rank.Eight)
                }
            };
            var player2 = new Player("Tester2")
            {
                Deck = new List <Card>()
                {
                    new Card(Suit.Diamonds, Rank.Five)
                }
            };

            _mockPlayerService.Setup(mps => mps.RemoveTopCardForPlayer(player1)).Returns(player1.Deck.First());
            _mockPlayerService.Setup(mps => mps.RemoveTopCardForPlayer(player2)).Returns(player2.Deck.First());
            var currentRound = new CurrentRound(new List <Player>()
            {
                player1, player2
            });

            _gameRoundService.AddCardFromAllPlayersToPot(currentRound);

            _mockPlayerService.Verify(mps => mps.RemoveTopCardForPlayer(player1), Times.Once);
            _mockPlayerService.Verify(mps => mps.RemoveTopCardForPlayer(player2), Times.Once);
        }
Exemple #2
0
        public SingleCardPlayResult ContinueRoundWithWar()
        {
            var singleCardPlayResult = _gameRoundService.GetResultIfNotEnoughCardsToContinue(_currentRound);

            if (singleCardPlayResult == null)
            {
                //Add extra card to pot before revealing next card for war result
                _gameRoundService.AddCardFromAllPlayersToPot(_currentRound);
                singleCardPlayResult = PlaySingleCardDraw();
            }
            return(singleCardPlayResult);
        }