有人可以解释为什么这个测试失败了:
[Fact]
public void ResolveAllDoesNotReturnServicesRegisteredInParent()
{
// arrange
var windsorContainer = new WindsorContainer();
windsorContainer.Register(Component.For<IView>().ImplementedBy<ViewA>().LifeStyle.Transient);
windsorContainer.Register(Component.For<IView>().ImplementedBy<ViewB>().LifeStyle.Transient);
var childContainer = new WindsorContainer();
windsorContainer.AddChildContainer(childContainer);
// act
IView[] views = childContainer.ResolveAll<IView>();
// assert
Assert.True(views.Length == 2);
}
答案 0 :(得分:1)
如果你从父母那里解决,那会成功吗?请注意,ResolveAll将仅解析可解析的组件。