From 58d0c2b6e0bff9b8bf976ab30f9b2ffba2753143 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Fri, 30 May 2014 00:51:03 +0200 Subject: [PATCH] Add test for autowiring unregistered types --- test/poodinis/autowiretest.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/poodinis/autowiretest.d b/test/poodinis/autowiretest.d index f0cea0f..bb7bc80 100644 --- a/test/poodinis/autowiretest.d +++ b/test/poodinis/autowiretest.d @@ -1,5 +1,7 @@ import poodinis.autowire; +import std.exception; + version(unittest) { class ComponentA { } @@ -55,4 +57,11 @@ version(unittest) { auto actualComponent = componentD.componentC; assert(expectedComponent is actualComponent, "Autowiring the second time wired a different instance"); } + + // Test autowiring unregistered type + unittest { + auto container = new Container(); + ComponentD componentD = new ComponentD(); + assertThrown!(ResolveException)(container.autowire!(ComponentD)(componentD), "Autowiring unregistered type should throw ResolveException"); + } } \ No newline at end of file