Add test for autowiring unregistered types

This commit is contained in:
Mike Bierlee 2014-05-30 00:51:03 +02:00
parent 52936379e4
commit 58d0c2b6e0

View file

@ -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");
}
}