@@ -33,6 +33,9 @@ public WhenDependenciesHaveTwoWayCircularReferenceBetweenConstructors()
3333
3434 this . kernel . Bind < IDecoratorPattern > ( ) . To < Decorator1 > ( ) . WhenInjectedInto < Decorator2 > ( ) ;
3535 this . kernel . Bind < IDecoratorPattern > ( ) . To < Decorator2 > ( ) ;
36+
37+ this . kernel . Bind < IDecoratorPattern > ( ) . To < Decorator3 > ( ) . Named ( "Decorator3" ) ;
38+ this . kernel . Bind < IDecoratorPattern > ( ) . To < Decorator4 > ( ) . Named ( "Decorator4" ) ;
3639 }
3740
3841 [ Fact ]
@@ -43,9 +46,15 @@ public void DoesNotThrowExceptionIfHookIsCreated()
4346 }
4447
4548 [ Fact ]
46- public void DoesNotThrowExceptionIfConditionaDoesNotMatch ( )
49+ public void DoesNotThrowExceptionIfConditionDoesNotMatch ( )
50+ {
51+ this . kernel . Get < IDecoratorPattern > ( ( string ) null ) ;
52+ }
53+
54+ [ Fact ]
55+ public void DoesNotThrowExceptionWithNamedBinding ( )
4756 {
48- this . kernel . Get < IDecoratorPattern > ( ) ;
57+ this . kernel . Get < IDecoratorPattern > ( "Decorator4" ) ;
4958 }
5059
5160 [ Fact ]
@@ -189,19 +198,27 @@ public WhenDependenciesHaveTwoWayCircularReferenceBetweenConstructorAndProperty(
189198 }
190199
191200 [ Fact ]
192- public void ThrowsActivationExceptionWhenHookIsResolved ( )
201+ public void DoesNotThrowExceptionWhenGetFoo ( )
193202 {
194- Assert . Throws < ActivationException > ( ( ) => this . kernel . Get < TwoWayConstructorPropertyFoo > ( ) ) ;
203+ this . kernel . Get < TwoWayConstructorPropertyFoo > ( ) ;
195204 }
196205
197206 [ Fact ]
198- public void DoesNotThrowException ( )
207+ public void DoesNotThrowExceptionWhenGetBar ( )
199208 {
200209 this . kernel . Get < TwoWayConstructorPropertyBar > ( ) ;
201210 }
202211
203212 [ Fact ]
204- public void ScopeIsRespected ( )
213+ public void ScopeIsRespectedWhenGetFooFirstly ( )
214+ {
215+ var foo = this . kernel . Get < TwoWayConstructorPropertyFoo > ( ) ;
216+ var bar = this . kernel . Get < TwoWayConstructorPropertyBar > ( ) ;
217+ foo . Bar . Should ( ) . BeSameAs ( bar ) ;
218+ }
219+
220+ [ Fact ]
221+ public void ScopeIsRespectedWhenGetBarFirstly ( )
205222 {
206223 var bar = this . kernel . Get < TwoWayConstructorPropertyBar > ( ) ;
207224 var foo = this . kernel . Get < TwoWayConstructorPropertyFoo > ( ) ;
@@ -344,4 +361,11 @@ public class Decorator2 : IDecoratorPattern
344361 {
345362 public Decorator2 ( IDecoratorPattern decorator ) { }
346363 }
364+
365+ public class Decorator3 : IDecoratorPattern { }
366+
367+ public class Decorator4 : IDecoratorPattern
368+ {
369+ public Decorator4 ( [ Named ( "Decorator3" ) ] IDecoratorPattern decorator ) { }
370+ }
347371}
0 commit comments