0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-30 02:31:08 +00:00
CleanArchitecture/CleanArchitecture.IntegrationTests/Fixtures/TestFixtureBase.cs
2023-03-09 16:48:04 +01:00

36 lines
1012 B
C#

using CleanArchitecture.Infrastructure.Database;
using CleanArchitecture.IntegrationTests.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace CleanArchitecture.IntegrationTests.Fixtures;
public class TestFixtureBase
{
public HttpClient ServerClient { get; }
public TestFixtureBase()
{
var projectDir = Directory.GetCurrentDirectory();
var configPath = Path.Combine(projectDir, "appsettings.Integration.json");
var factory = new CleanArchitectureWebApplicationFactory(
SeedTestData,
RegisterCustomServicesHandler,
configPath);
ServerClient = factory.CreateClient();
ServerClient.Timeout = TimeSpan.FromMinutes(5);
}
protected virtual void SeedTestData(ApplicationDbContext context)
{
}
protected virtual void RegisterCustomServicesHandler(
IServiceCollection services,
ServiceProvider serviceProvider,
IServiceProvider scopedServices)
{
}
}