diff --git a/Benchmarking/Benchmarks/Program.cs b/Benchmarking/Benchmarks/Program.cs index e97870f..71e07b6 100644 --- a/Benchmarking/Benchmarks/Program.cs +++ b/Benchmarking/Benchmarks/Program.cs @@ -12,7 +12,7 @@ namespace Benchmarks; [JsonExporterAttribute.FullCompressed] public class ResolveBenchmarks { - private readonly IContainer m_container = new DependencyInjectionContainer(default, default, default!); + private readonly IContainer m_container = new DependencyInjectionContainer(default, default, new NonInjectedClass()); [Benchmark] public ChainA ResolveChain() => m_container.Resolve(); diff --git a/FactoryGenerator/FactoryGenerator.cs b/FactoryGenerator/FactoryGenerator.cs index 78bb3ec..7919e6c 100644 --- a/FactoryGenerator/FactoryGenerator.cs +++ b/FactoryGenerator/FactoryGenerator.cs @@ -496,7 +496,7 @@ public bool TryResolve(Type type, out object? resolved) resolved = factory(); return true; }} - if(Base is not null) + else if(Base is not null) {{ return Base.TryResolve(type, out resolved); }} @@ -516,7 +516,7 @@ public bool TryResolve(out T? resolved) return true; }} }} - if(Base is not null) + else if(Base is not null) {{ return Base.TryResolve(out resolved); }} diff --git a/Tests/FactoryGenerator.Tests/InjectionDetectionTests.cs b/Tests/FactoryGenerator.Tests/InjectionDetectionTests.cs index 391fee7..355b861 100644 --- a/Tests/FactoryGenerator.Tests/InjectionDetectionTests.cs +++ b/Tests/FactoryGenerator.Tests/InjectionDetectionTests.cs @@ -225,6 +225,7 @@ public void ContainerMayCreateItself() var newContainer = new DependencyInjectionContainer(m_container); var resolved = m_container.Resolve>(); resolved.Count().ShouldBe(6); + var nonInjected = m_container.Resolve(); } [Fact] public void HierarchicalContainersResolveArraysProperly()