persistence/DD.Persistence.IntegrationTests/TestHttpClientFactory.cs

28 lines
838 B
C#
Raw Normal View History

using DD.Persistence.Client.Helpers;
using Microsoft.Extensions.Configuration;
namespace DD.Persistence.IntegrationTests
2024-11-21 14:50:36 +05:00
{
/// <summary>
/// Фабрика HTTP клиентов для интеграционных тестов
/// </summary>
public class TestHttpClientFactory : IHttpClientFactory
{
private readonly WebAppFactoryFixture factory;
private readonly IConfiguration configuration;
2024-11-21 14:50:36 +05:00
public TestHttpClientFactory(WebAppFactoryFixture factory, IConfiguration configuration)
{
this.factory = factory;
this.configuration = configuration;
}
public HttpClient CreateClient(string name)
{
var client = factory.CreateClient();
client.Authorize(configuration);
return client;
}
}
2024-11-21 14:50:36 +05:00
}