mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add test for testing if autowiring still works when using resolveAll
This commit is contained in:
parent
53fb0d8116
commit
805a3ebaeb
|
@ -17,6 +17,11 @@ version(unittest) {
|
|||
class TestClass : TestInterface {
|
||||
}
|
||||
|
||||
class TestClassDeux : TestInterface {
|
||||
@Autowire
|
||||
public UnrelatedClass unrelated;
|
||||
}
|
||||
|
||||
class UnrelatedClass{
|
||||
}
|
||||
|
||||
|
@ -454,4 +459,16 @@ version(unittest) {
|
|||
|
||||
assert(colors.length == 2, "resolveAll did not yield all instances of interface type");
|
||||
}
|
||||
|
||||
// Test autowiring instances resolved in array
|
||||
unittest {
|
||||
shared(DependencyContainer) container = new DependencyContainer();
|
||||
container.register!UnrelatedClass;
|
||||
container.register!(TestInterface, TestClassDeux);
|
||||
|
||||
auto instances = container.resolveAll!TestInterface;
|
||||
auto instance = cast(TestClassDeux) instances[0];
|
||||
|
||||
assert(instance.unrelated !is null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue