Exemplo n.º 1
0
        public void PlayDevelopmentCardCallsCurrentTurn()
        {
            var players = CreateFakePlayers(3);
            var provider = new Mock<ITurnProvider>();
            var turn = new Mock<IGameTurn>();
            provider.Setup(p => p.GetNext()).Returns(turn.Object);

            var card = new Mock<IDevelopmentCard>();
            var bank = new Mock<IBank>();

            var game = new Game(players, provider.Object, bank.Object);
            game.Start();

            game.PlayDevelopmentCard(card.Object);

            turn.Verify(t => t.PlayDevelopmentCard(card.Object));
        }
Exemplo n.º 2
0
        public void CantPlayDevelopmentCardIfCurrentTurnIsNotGameTurn()
        {
            var players = CreateFakePlayers(3);
            var provider = new Mock<ITurnProvider>();
            var turn = new Mock<ITurn>();
            provider.Setup(p => p.GetNext()).Returns(turn.Object);

            var card = new Mock<IDevelopmentCard>();
            var bank = new Mock<IBank>();

            var game = new Game(players, provider.Object, bank.Object);
            game.Start();

            Assert.Throws<InvalidOperationException>((() => game.PlayDevelopmentCard(card.Object)));
        }