From ec5cad2bbf4164d0a458ff4063cadb25c31f6caf Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Fri, 30 May 2014 01:04:40 +0200 Subject: [PATCH] Add test for autowiring member with different attribute --- test/poodinis/autowiretest.d | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/poodinis/autowiretest.d b/test/poodinis/autowiretest.d index bb7bc80..42aca4d 100644 --- a/test/poodinis/autowiretest.d +++ b/test/poodinis/autowiretest.d @@ -28,6 +28,13 @@ version(unittest) { } } + class DummyAttribute{}; + + class ComponentE { + @DummyAttribute + public ComponentC componentC; + } + // Test autowiring concrete type to existing instance unittest { auto container = new Container(); @@ -64,4 +71,12 @@ version(unittest) { ComponentD componentD = new ComponentD(); 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"); + } } \ No newline at end of file