Whats the correct way to check the implementation of a registered component?
-
14-07-2021 - |
Question
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?
La solution
var handler = container.Kernel.GetHandler(typeof(IFoo));
Assert.AreEqual(typeof(Foo), handler.Component.Implementation);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow