Example #1
0
        public void Build_SecondPlayerType_VerifySecondPlayerAdded()
        {
            var player = new MockPlayer();
            var startingPlayerMapper = new MockStartingPlayerMapper().AddReturnsItself();
            var players          = new MockPlayers().AddReturnsItself();
            var secondPlayerType = new MockPlayerType().PlayerReturns(player);
            var builder          = BuildGameBuilder(startingPlayerMapper, players, secondPlayerType: secondPlayerType);

            builder.Build();

            secondPlayerType.VerifyPlayerCalled();
            players.VerifyAddCalled(player);
            startingPlayerMapper.VerifyAddCalled(StartingPlayer.As().SecondPlayer(), player);
        }
Example #2
0
        public void Build_SetStartingPlayer()
        {
            var player1              = new MockPlayer();
            var player2              = new MockPlayer();
            var expectedPlayers      = new MockPlayers().CurrentReturns(player1);
            var startingPlayerMapper = new MockStartingPlayerMapper().AddReturnsItself().KeyReturns(player1);
            var players              = new MockPlayers().AddReturnsItself().SetCurrentPlayerReturns(expectedPlayers);
            var firstPlayerType      = new MockPlayerType().PlayerReturns(player1);
            var secondPlayerType     = new MockPlayerType().PlayerReturns(player2);
            var startingPlayer       = new MockStartingPlayer();
            var builder              = BuildGameBuilder(startingPlayerMapper, players, firstPlayerType: firstPlayerType, secondPlayerType: secondPlayerType, startingPlayer: startingPlayer);

            builder.Build();

            players.VerifySetCurrentPlayerCalled(player1);
            startingPlayerMapper.VerifyKeyCalled(startingPlayer);
        }