diff --git a/src/Recyclarr.TestLibrary/IntegrationFixture.cs b/src/Recyclarr.TestLibrary/IntegrationFixture.cs index c7277448..21442a86 100644 --- a/src/Recyclarr.TestLibrary/IntegrationFixture.cs +++ b/src/Recyclarr.TestLibrary/IntegrationFixture.cs @@ -9,14 +9,15 @@ using Serilog.Events; namespace Recyclarr.TestLibrary; [FixtureLifeCycle(LifeCycle.InstancePerTestCase)] -public abstract class IntegrationFixture +public abstract class IntegrationFixture : IDisposable { private readonly ILifetimeScope _container; + private readonly FakeConsole _console = new(); protected IntegrationFixture() { var compRoot = new CompositionRoot(); - _container = compRoot.Setup(default, new FakeConsole(), LogEventLevel.Debug).Container + _container = compRoot.Setup(default, _console, LogEventLevel.Debug).Container .BeginLifetimeScope(builder => { builder.RegisterSource(); @@ -36,4 +37,21 @@ public abstract class IntegrationFixture { return _container.Resolve(); } + + protected virtual void Dispose(bool disposing) + { + if (!disposing) + { + return; + } + + _container.Dispose(); + _console.Dispose(); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } }