From 6b74419932e24d2da363fe64e61235d096135c94 Mon Sep 17 00:00:00 2001 From: "Simon G." Date: Tue, 4 Nov 2025 14:12:18 +0100 Subject: [PATCH] #61: move test --- .../DisposeStrategyTest.cs | 25 +------------------ .../IocContainerInterfaceSegregationTest.cs | 11 ++++++++ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Test.LightweightIocContainer/DisposeStrategyTest.cs b/Test.LightweightIocContainer/DisposeStrategyTest.cs index e60a781..565d7bd 100644 --- a/Test.LightweightIocContainer/DisposeStrategyTest.cs +++ b/Test.LightweightIocContainer/DisposeStrategyTest.cs @@ -13,11 +13,7 @@ namespace Test.LightweightIocContainer; public class DisposeStrategyTest { [UsedImplicitly] - public interface ITest : IDisposable - { - - } - + public interface ITest : IDisposable; private class Test : ITest { public void Dispose() => throw new Exception(); @@ -33,14 +29,6 @@ public class DisposeStrategyTest private class TestNotDisposable; - [UsedImplicitly] - public interface IInterfaceSegregation : ITest; - private class TestInterfaceSegregation : IInterfaceSegregation - { - public void Dispose() => throw new Exception(); - } - - [Test] public void TestValidContainerDisposeStrategySingleton() { @@ -123,15 +111,4 @@ public class DisposeStrategyTest IocContainer iocContainer = new(); Assert.Throws(() => iocContainer.Register(r => r.Add(Lifestyle.Singleton).WithDisposeStrategy(DisposeStrategy.Container))); } - - [Test] - public void TestValidDisposeStrategyForSingletonInterfaceSegregation() - { - IocContainer iocContainer = new(); - iocContainer.Register(r => r.Add(Lifestyle.Singleton).WithDisposeStrategy(DisposeStrategy.Application)); - - iocContainer.Resolve(); - - Assert.DoesNotThrow(() => iocContainer.Dispose()); - } } \ No newline at end of file diff --git a/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs b/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs index b6adda7..a1d162f 100644 --- a/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs +++ b/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs @@ -147,4 +147,15 @@ public class IocContainerInterfaceSegregationTest Assert.That(anotherBar, Is.SameAs(foo)); Assert.That(anotherOne, Is.SameAs(foo)); } + + [Test] + public void TestValidDisposeStrategyForSingleton() + { + IocContainer iocContainer = new(); + iocContainer.Register(r => r.Add(Lifestyle.Singleton).WithDisposeStrategy(DisposeStrategy.Application)); + + iocContainer.Resolve(); + + Assert.DoesNotThrow(() => iocContainer.Dispose()); + } } \ No newline at end of file