using ClaudeDo.Installer.Core.Interfaces;

namespace ClaudeDo.Installer.Tests.Checks;

internal sealed class FakeProcessRunner : IProcessRunner
{
    private readonly Queue<(int ExitCode, string Output)> _responses;

    public FakeProcessRunner(params (int ExitCode, string Output)[] responses)
    {
        _responses = new Queue<(int, string)>(responses);
    }

    public List<(string FileName, string Arguments)> Calls { get; } = new();

    public Task<(int ExitCode, string Output)> RunAsync(string fileName, string arguments, string? workingDirectory, CancellationToken ct)
    {
        Calls.Add((fileName, arguments));
        var response = _responses.Count > 0 ? _responses.Dequeue() : (0, "");
        return Task.FromResult(response);
    }
}
