diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index 4de75db..2ba1028 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -547,6 +547,20 @@ version (unittest) assert(instance.red is container.resolve!Red); } + // Test autowired, constructor injected class where constructor argument is templated + unittest + { + auto container = new shared DependencyContainer(); + container.register!PieChart; + container.register!(TemplatedComponent!PieChart); + container.register!(ClassWithTemplatedConstructorArg!PieChart); + auto instance = container.resolve!(ClassWithTemplatedConstructorArg!PieChart); + + assert(instance !is null); + assert(instance.dependency !is null); + assert(instance.dependency.instance !is null); + } + // Test injecting constructor with super-type parameter unittest { diff --git a/test/poodinis/testclasses.d b/test/poodinis/testclasses.d index 7d1bc3c..4e6133e 100644 --- a/test/poodinis/testclasses.d +++ b/test/poodinis/testclasses.d @@ -779,4 +779,14 @@ version (unittest) { } + + class ClassWithTemplatedConstructorArg(T) + { + public TemplatedComponent!T dependency; + + this(TemplatedComponent!T assignedDependency) + { + this.dependency = assignedDependency; + } + } }