コード例 #1
0
        private LocalGameControllerTestCreator.TestInstances TestSetupWithExplictGameBoard(Guid bankId, DevelopmentCard developmentCard, GameBoard gameBoard)
        {
            MockPlayer         player;
            MockComputerPlayer firstOpponent, secondOpponent, thirdOpponent;

            LocalGameControllerTestCreator.CreateDefaultPlayerInstances(out player, out firstOpponent, out secondOpponent, out thirdOpponent);
            var playerPool = LocalGameControllerTestCreator.CreateMockPlayerPool(player, firstOpponent, secondOpponent, thirdOpponent);

            playerPool.GetBankId().Returns(bankId);

            var playerSetup = new LocalGameControllerTestCreator.PlayerSetup(player, firstOpponent, secondOpponent, thirdOpponent, playerPool);

            var testInstances = LocalGameControllerTestCreator.CreateTestInstances(
                null,
                playerSetup,
                this.CreateMockCardDevelopmentCardHolder(developmentCard),
                gameBoard);
            var localGameController = testInstances.LocalGameController;

            LocalGameControllerTestSetup.LaunchGameAndCompleteSetup(localGameController);

            testInstances.Dice.AddSequence(new[] { 8u }); // First turn roll i.e. no robber triggered

            return(testInstances);
        }
コード例 #2
0
        private void RunOpponentDataPassBackTests(GameOptions gameOptions)
        {
            var player         = new MockPlayer(PlayerName);
            var firstOpponent  = new MockComputerPlayer(FirstOpponentName);
            var secondOpponent = new MockComputerPlayer(SecondOpponentName);
            var thirdOpponent  = new MockComputerPlayer(ThirdOpponentName);

            var mockPlayerPool      = LocalGameControllerTestCreator.CreateMockPlayerPool(player, firstOpponent, secondOpponent, thirdOpponent);
            var playerSetup         = new LocalGameControllerTestCreator.PlayerSetup(player, firstOpponent, secondOpponent, thirdOpponent, mockPlayerPool);
            var localGameController = LocalGameControllerTestCreator.CreateTestInstances(null, playerSetup, null, null).LocalGameController;

            PlayerDataBase[] playerDataViews = null;
            localGameController.GameJoinedEvent = (PlayerDataBase[] p) => { playerDataViews = p; };
            localGameController.JoinGame(gameOptions);

            playerDataViews.ShouldNotBeNull();
            playerDataViews.Length.ShouldBe(4);

            this.AssertPlayerDataViewIsCorrect(player, (PlayerDataModel)playerDataViews[0]);
            this.AssertPlayerDataViewIsCorrect(firstOpponent, (PlayerDataModel)playerDataViews[1]);
            this.AssertPlayerDataViewIsCorrect(secondOpponent, (PlayerDataModel)playerDataViews[2]);
            this.AssertPlayerDataViewIsCorrect(thirdOpponent, (PlayerDataModel)playerDataViews[3]);
        }