Proxy instantiation error for Atlassian.Jira.Jira in .NET - How can I properly unit test JIRA services?

Encountered error mocking Atlassian.Jira.Jira for .NET unit tests. How can I simulate Jira functionality using an interface-based adapter? See example:

public class MockJiraHandler {
    private readonly IJiraAdapter _adapter;

    public MockJiraHandler(IJiraAdapter adapter) {
        _adapter = adapter;
    }

    public async Task<string?> GenerateTicketAsync(string summary) {
        var ticket = _adapter.CreateTicket("PROJ");
        await ticket.CommitAsync();
        return ticket.Id;
    }
}

Using an interface-based adapter resolved many issues in my projects. I migrated code that directly instantiates Atlassian.Jira.Jira into an abstraction layer. This separation allowed me to inject mock implementations for unit testing and kept business logic isolated from external dependencies. In my experience, this design improves testability and flexibility, as it lets me simulate various responses from JIRA without hitting the actual service. Additionally, the adapter pattern makes it easier to switch implementations if needed or simulate failure scenarios in a controlled environment.

I had encountered a similar complication in my previous projects where direct instantiation of the Atlassian.Jira.Jira class caused significant issues when setting up unit tests. I found that introducing an interface-based adapter not only simplified my testing strategy but also allowed me to simulate various environments without the overhead of external dependencies. This approach enabled me to replace the real JIRA calls with controlled mock implementations, ensuring my tests remained stable and predictable while isolating any external failures from affecting the overall test suite.

i faced a simmilar issue. i used a self built adapter that fakes the jira calls. it let me simulate both success & failures making tests far more reliable. hope this helps