From 805a3ebaeb67b64c2b2352785b87513986f60231 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 4 Jul 2015 13:59:10 +0200 Subject: [PATCH] Add test for testing if autowiring still works when using resolveAll --- test/poodinis/containertest.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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); + } }