diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index ad4e98f..65b640a 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -17,6 +17,11 @@ version(unittest) { class TestClass : TestInterface { } + class TestClassDeux : TestInterface { + @Autowire + public UnrelatedClass unrelated; + } + class UnrelatedClass{ } @@ -454,4 +459,16 @@ version(unittest) { assert(colors.length == 2, "resolveAll did not yield all instances of interface type"); } + + // Test autowiring instances resolved in array + unittest { + shared(DependencyContainer) container = new DependencyContainer(); + container.register!UnrelatedClass; + container.register!(TestInterface, TestClassDeux); + + auto instances = container.resolveAll!TestInterface; + auto instance = cast(TestClassDeux) instances[0]; + + assert(instance.unrelated !is null); + } }