Skip to content

Instantly share code, notes, and snippets.

@hazzik
Created May 13, 2011 03:58
Show Gist options
  • Save hazzik/969951 to your computer and use it in GitHub Desktop.
Save hazzik/969951 to your computer and use it in GitHub Desktop.
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