문제

In test mode (of course I don't care about the implementation elsewhere), I want to check the type of the registered component. I can do it like this:

        if (_container.Kernel.HasComponent(typeof(IIDAApi)))
        {
            if (_container.Resolve<IIDAApi>() is IDAApiStub)
                return;
        }

But I would rather expect the registered configuration if possible. Tips?

도움이 되었습니까?

해결책

var handler = container.Kernel.GetHandler(typeof(IFoo));

Assert.AreEqual(typeof(Foo), handler.Component.Implementation);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top