views:

32

answers:

1

Can someone please explain why this test fails:

    [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);
    }
+1  A: 

And if you resolve from parent will that succeed? Notice that ResolveAll will only resolve the components that are resolvable.

Krzysztof Koźmic
Well, that was embarrassing. I missed a dependency in the configuration.
Marius

related questions