質問

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