diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index f092960..244e054 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -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); + } }