diff --git a/LightweightIocContainer/Exceptions/CircularDependencyException.cs b/LightweightIocContainer/Exceptions/CircularDependencyException.cs index 1aa9678..6d9f064 100644 --- a/LightweightIocContainer/Exceptions/CircularDependencyException.cs +++ b/LightweightIocContainer/Exceptions/CircularDependencyException.cs @@ -44,7 +44,7 @@ namespace LightweightIocContainer.Exceptions get { StringBuilder message = new($"Circular dependency has been detected when trying to resolve `{ResolvingType}`.\n"); - if (ResolveStack == null || !ResolveStack.Any()) + if (!ResolveStack.Any()) return message.ToString(); message.Append("Resolve stack that resulted in the circular dependency:\n"); diff --git a/Test.LightweightIocContainer/IocContainerRecursionTest.cs b/Test.LightweightIocContainer/IocContainerRecursionTest.cs index 1e0c67d..b8f8952 100644 --- a/Test.LightweightIocContainer/IocContainerRecursionTest.cs +++ b/Test.LightweightIocContainer/IocContainerRecursionTest.cs @@ -134,14 +134,6 @@ namespace Test.LightweightIocContainer Assert.AreEqual(message, exception.Message); } - [Test] - public void TestCircularDependencyExceptionNoStack() - { - CircularDependencyException circularDependencyException = new(typeof(IFoo), null); - string message = $"Circular dependency has been detected when trying to resolve `{typeof(IFoo)}`.\n"; - Assert.AreEqual(message, circularDependencyException.Message); - } - [Test] public void TestNonCircularDependencies() {