From f2170d3d4f8a5dcde556ae1a776c83a5c3d6c892 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Sun, 1 Sep 2024 20:24:17 -0700 Subject: [PATCH] Dispose tracker in tests before it loses scope. --- .../Specification/AssumedBehaviorTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Autofac.Extensions.DependencyInjection.Test/Specification/AssumedBehaviorTests.cs b/test/Autofac.Extensions.DependencyInjection.Test/Specification/AssumedBehaviorTests.cs index 39c043c..90b5c56 100644 --- a/test/Autofac.Extensions.DependencyInjection.Test/Specification/AssumedBehaviorTests.cs +++ b/test/Autofac.Extensions.DependencyInjection.Test/Specification/AssumedBehaviorTests.cs @@ -174,11 +174,10 @@ public void ServiceScopesAreFlat() [Fact] public void ServiceInstancesRegisteredAreNotDisposedWhenTheProviderIsDisposed() { - var externalService = new DisposeTracker(); + using var externalService = new DisposeTracker(); var services = new ServiceCollection().AddSingleton(externalService); var rootProvider = CreateServiceProvider(services); ((IDisposable)rootProvider).Dispose(); - Assert.False(externalService.Disposed); }