@ -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");
@ -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);
public void TestNonCircularDependencies()