persistence/DD.Persistence.IntegrationTests/BaseIntegrationTest.cs
Olga Nemt d90b72b14e 1. Исправлены namespaces.
2. Добавлен проект DD.Persistence.App со всеми необходимыми настройками
2024-12-16 15:38:46 +05:00

27 lines
719 B
C#

using Microsoft.Extensions.DependencyInjection;
using DD.Persistence.Database;
using DD.Persistence.Database.Model;
using Xunit;
namespace DD.Persistence.IntegrationTests;
public abstract class BaseIntegrationTest : IClassFixture<WebAppFactoryFixture>, IDisposable
{
protected readonly IServiceScope scope;
protected readonly PersistenceDbContext dbContext;
protected BaseIntegrationTest(WebAppFactoryFixture factory)
{
scope = factory.Services.CreateScope();
dbContext = scope.ServiceProvider.GetRequiredService<PersistencePostgresContext>();
}
public void Dispose()
{
scope.Dispose();
dbContext.Dispose();
GC.SuppressFinalize(this);
}
}