mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add test of prevention of transitive dependencies
This commit is contained in:
parent
67fa51a14f
commit
9cc320aa93
|
@ -207,6 +207,18 @@ version(unittest) {
|
|||
this(Pot pot) {}
|
||||
}
|
||||
|
||||
class Rock {
|
||||
this(Scissors scissors) {}
|
||||
}
|
||||
|
||||
class Paper {
|
||||
this(Rock rock) {}
|
||||
}
|
||||
|
||||
class Scissors {
|
||||
this(Paper paper) {}
|
||||
}
|
||||
|
||||
// Test register concrete type
|
||||
unittest {
|
||||
auto container = new shared DependencyContainer();
|
||||
|
@ -712,4 +724,14 @@ version(unittest) {
|
|||
|
||||
assertThrown!InstanceCreationException(container.resolve!Pot);
|
||||
}
|
||||
|
||||
// Test prevention of transitive circular dependencies during constructor injection
|
||||
unittest {
|
||||
auto container = new shared DependencyContainer();
|
||||
container.register!Rock;
|
||||
container.register!Paper;
|
||||
container.register!Scissors;
|
||||
|
||||
assertThrown!InstanceCreationException(container.resolve!Rock);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue