mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add test for autowiring member with different attribute
This commit is contained in:
parent
58d0c2b6e0
commit
ec5cad2bbf
|
@ -28,6 +28,13 @@ version(unittest) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DummyAttribute{};
|
||||||
|
|
||||||
|
class ComponentE {
|
||||||
|
@DummyAttribute
|
||||||
|
public ComponentC componentC;
|
||||||
|
}
|
||||||
|
|
||||||
// Test autowiring concrete type to existing instance
|
// Test autowiring concrete type to existing instance
|
||||||
unittest {
|
unittest {
|
||||||
auto container = new Container();
|
auto container = new Container();
|
||||||
|
@ -64,4 +71,12 @@ version(unittest) {
|
||||||
ComponentD componentD = new ComponentD();
|
ComponentD componentD = new ComponentD();
|
||||||
assertThrown!(ResolveException)(container.autowire!(ComponentD)(componentD), "Autowiring unregistered type should throw ResolveException");
|
assertThrown!(ResolveException)(container.autowire!(ComponentD)(componentD), "Autowiring unregistered type should throw ResolveException");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test autowiring member with non-autowire attribute does not autowire
|
||||||
|
unittest {
|
||||||
|
auto container = new Container();
|
||||||
|
ComponentE componentE = new ComponentE();
|
||||||
|
container.autowire!ComponentE(componentE);
|
||||||
|
assert(componentE.componentC is null, "Autowiring should not occur for members with attributes other than @Autowire");
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue