Created
May 13, 2011 03:58
-
-
Save hazzik/969951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WindsorTests | |
{ | |
public interface ISomeServiceConsumer { } | |
public interface ISomeService { } | |
public class SomeServiceConsumer : ISomeServiceConsumer | |
{ | |
public SomeServiceConsumer(ISomeService someService) { } | |
} | |
public class SomeService : ISomeService { } | |
[Fact] | |
public void GetComponentFromParentContainerWhichHasDependenciesInChildContainer() | |
{ | |
using (var parent = new WindsorContainer()) | |
using (var child = new WindsorContainer()) | |
{ | |
child.Register(Component.For<ISomeService>().ImplementedBy<SomeService>()); | |
parent.AddChildContainer(child); | |
parent.Register(Component.For<ISomeServiceConsumer>().ImplementedBy<SomeServiceConsumer>()); | |
//parent.Register(Component.For<ISomeService>()); | |
var consumer = child.Resolve<ISomeServiceConsumer>(); | |
Assert.NotNull(consumer); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment