mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add test for autowiring unregistered types
This commit is contained in:
parent
52936379e4
commit
58d0c2b6e0
|
@ -1,5 +1,7 @@
|
||||||
import poodinis.autowire;
|
import poodinis.autowire;
|
||||||
|
|
||||||
|
import std.exception;
|
||||||
|
|
||||||
version(unittest) {
|
version(unittest) {
|
||||||
class ComponentA {
|
class ComponentA {
|
||||||
}
|
}
|
||||||
|
@ -55,4 +57,11 @@ version(unittest) {
|
||||||
auto actualComponent = componentD.componentC;
|
auto actualComponent = componentD.componentC;
|
||||||
assert(expectedComponent is actualComponent, "Autowiring the second time wired a different instance");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue