Add test for testing if autowiring still works when using resolveAll

This commit is contained in:
Mike Bierlee 2015-07-04 13:59:10 +02:00
parent 53fb0d8116
commit 805a3ebaeb

View file

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