Exemple #1
0
        public void Handles_Should_Choose_A_Position()
        {
            var context       = new MockIntelligenceContext();
            var currentPlayer = new MockPlayer();
            var player        = new MockPlayer();
            var board         = new MockBoard {
                Size = 3
            };
            var game = new MockGame {
                Board   = board,
                Players = new List <IPlayer> {
                    currentPlayer, player
                },
                CurrentPlayer = currentPlayer
            }.IsOverStubbedToReturn(false);
            var newContext     = new MockIntelligenceContext();
            var contextFactory = new MockIntelligenceContextFactory().CreateStubbedToReturn(newContext);

            var state = BuildPlayer1TurnState(game, contextFactory, context);

            state.Handle();

            game.VerifyMakeMoveCalled(context);
            game.VerifySwitchPlayerCalled();
            contextFactory.VerifyCreatedCalled(game);
        }
Exemple #2
0
        public void Verify_New_Context_Created()
        {
            var gameSettings = new GameSettings()
            {
                PlayerStartType = PlayerStartType.FirstPlayerFirst
            };
            var game            = new MockGame();
            var gameInitializer = new MockGameInitializer().CreateStubbedToReturn(game);
            var contextFactory  = new MockIntelligenceContextFactory();
            var state           = BuildGameStartedState(gameSettings, gameInitializer, contextFactory);

            state.Handle();

            gameInitializer.VerifyCreateCalled(gameSettings);
            contextFactory.VerifyCreatedCalled(game);
        }