C#C
C#3y ago
illunix

❔ How to mock HttpClient that is automatically applied in class without IHttpClientFactory

Hello, I have a problem because I don't know how can I mock HttpClient in my tests for StripeClient, I don't use IHttpClientFactory, HttpClient is assigned automatically
public sealed partial class StripeClient : IStripeClient
{
    private readonly HttpClient _http;
}


services.AddHttpClient<IStripeClient, StripeClient>(...)
Was this page helpful?