Frage

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?

War es hilfreich?

Lösung

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

Assert.AreEqual(typeof(Foo), handler.Component.Implementation);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top