feat: continued wip on supporting transactions

This commit is contained in:
Stevan Freeborn
2026-03-09 04:29:01 -05:00
parent 8d68bfc22a
commit 3866030eae
33 changed files with 1335 additions and 67 deletions
@@ -0,0 +1,44 @@
namespace FiscalOS.Infra.Tests.Integration;
public abstract class IntegrationTest : IAsyncLifetime
{
private bool _isDisposed;
private readonly FileSystem _fileSystem = new();
protected AppDbContext AppDbContext { get; }
protected IntegrationTest()
{
var options = Options.Create(new AppDbContextOptions()
{
DatabaseFilePath = $"{Guid.NewGuid()}.db",
});
AppDbContext = new(options, _fileSystem);
}
public async ValueTask InitializeAsync()
{
await AppDbContext.Database.MigrateAsync();
}
public async ValueTask DisposeAsync()
{
await DisposeAsync(true);
GC.SuppressFinalize(this);
}
protected virtual async Task DisposeAsync(bool disposing)
{
if (_isDisposed)
{
return;
}
if (disposing)
{
await AppDbContext.DisposeAsync();
}
_isDisposed = true;
}
}