def test_get_player_positions_for_player(row_length, player_symbol, board_positions, expected_board_positions):
    # given
    board = Board(row_length)
    board.board_positions = board_positions
    sample_player = Player(player_symbol, board)

    # when
    result = sample_player.get_player_positions()

    # then
    assert result == expected_board_positions
def test_player_move_when_have_player_move(get_player_move, row_length, player_symbol, board_positions, expected_board_positions):
    # given
    board = Board(row_length)
    board.board_positions = board_positions
    sample_player = Player(player_symbol, board)
    get_player_move.return_value = 1

    # when
    sample_player.player_move()

    # then
    assert board.board_positions == expected_board_positions
def test_no_moves_remain_when_no_moves_remain(row_length, board_positions):
    # given
    board = Board(row_length)
    board.board_positions = board_positions
    sample_player1 = Player("X", board)
    sample_player2 = Player("O", board)
    ajud = Ajudicator(board, sample_player1, sample_player2)

    # when
    result = ajud.no_moves_remain()

    # then
    assert result
def test_player_move_when_have_player_move(get_player_move):
    # given
    board = Board(3)
    board.board_positions = [1, "X", 3, 4, 5, 6, 7, 8, "X"]
    expected_board_positions = [" X ", "X", 3, 4, 5, 6, 7, 8, "X"]
    sample_player = Player("X", board)
    get_player_move.return_value = 1

    # when
    sample_player.player_move()

    # then
    assert board.board_positions == expected_board_positions
def test_find_which_player_has_won(row_length, board_positions, expected_winner):
    # given
    board = Board(row_length)
    board.board_positions = board_positions
    sample_player1 = Player("X", board)
    sample_player2 = Player("O", board)
    ajud = Ajudicator(board, sample_player1, sample_player2)

    # when
    winning_player = ajud.find_which_player_has_won()

    # then
    assert winning_player == expected_winner
def test_some_player_has_won_when_no_winner(row_length, board_positions):
    # given
    board = Board(row_length)
    board.board_positions = board_positions
    sample_player1 = Player("X", board)
    sample_player2 = Player("O", board)
    ajud = Ajudicator(board, sample_player1, sample_player2)

    # when
    result = ajud.some_player_has_won()

    # then
    assert not result