persistence/Persistence.IntegrationTests/BaseIntegrationTest.cs
Оля Бизюкова 47820ba32a - Editorconfig
- Файл со словами-исключениями в spellchecker
2024-12-09 13:19:55 +05:00

26 lines
644 B
C#

using Microsoft.Extensions.DependencyInjection;
using Persistence.Database.Model;
using Xunit;
namespace 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<PersistenceDbContext>();
}
public void Dispose()
{
scope.Dispose();
dbContext.Dispose();
}
}