From c0553967c9ac92eaed6ddea5d247fae6515771b7 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Tue, 23 Aug 2016 21:20:54 +0200 Subject: [PATCH] Add extra testcase --- test/poodinis/containertest.d | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index 5c57f7a..31a2383 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -191,6 +191,14 @@ version(unittest) { } } + class Wallpaper { + public Color color; + + this(Color color) { + this.color = color; + } + } + // Test register concrete type unittest { auto container = new shared DependencyContainer(); @@ -676,4 +684,15 @@ version(unittest) { assert(instance.moolah is container.resolve!Moolah); assert(instance.red is container.resolve!Red); } + + // Test injecting constructor with super-type parameter + unittest { + auto container = new shared DependencyContainer(); + container.register!Wallpaper; + container.register!(Color, Blue); + + auto instance = container.resolve!Wallpaper; + assert(instance !is null); + assert(instance.color is container.resolve!Blue); + } }