public ActionResult <string[]> Post(CurrentState currentState)
        {
            MoveGenerator mover     = new MoveGenerator(currentState);
            string        nextState = mover.DetermineNextMove();

            return(new ActionResult <string[]>(nextState.Split(',')));
        }
        public void DetermineNextMove_WhenAllSquaresPopulated_ReturnsInitialState()
        {
            string[]     currentBoardState = new string[] { "X", "O", "X", "X", "O", "X", "O", "X", "O" };
            CurrentState state             = new CurrentState()
            {
                CurrentBoard = currentBoardState,
                NextMove     = 'O'
            };

            MoveGenerator mover = new MoveGenerator(state);

            string nextMove = mover.DetermineNextMove();

            string expectedNextMove = "X,O,X,X,O,X,O,X,O";

            Assert.Equal(expectedNextMove, nextMove);
        }
        public void DetermineNextMove_WhenWinningMoveExistsOnRow_SelectIt()
        {
            string[]     currentBoardState = new string[] { "X", "X", "O", "X", "", "", "O", "", "O" };
            CurrentState state             = new CurrentState()
            {
                CurrentBoard = currentBoardState,
                NextMove     = 'O'
            };

            MoveGenerator mover = new MoveGenerator(state);

            string nextMove = mover.DetermineNextMove();

            string expectedNextMove = "X,X,O,X,,,O,O,O";

            Assert.Equal(expectedNextMove, nextMove);
        }
        public void DetermineNextMove_WhenBothWinningAndBlockingMovesAvailable_PrioritiseWinningMove()
        {
            string[]     currentBoardState = new string[] { "X", "O", "", "X", "", "X", "O", "", "O" };
            CurrentState state             = new CurrentState()
            {
                CurrentBoard = currentBoardState,
                NextMove     = 'O'
            };

            MoveGenerator mover = new MoveGenerator(state);

            string nextMove = mover.DetermineNextMove();

            string expectedNextMove = "X,O,,X,,X,O,O,O";

            Assert.Equal(expectedNextMove, nextMove);
        }