Search code examples
ninjectninject-2

Ninject how to check a binding for a given type is available without creating an instance


So I m just trying to test my modules, normally i would go and create a Kernel with the given module and then try to get an instance, however this scenario involves a few modules and it would be nicer if I could check that certain modules have access to certain Bindings (ie that implement and interface)

Is there any way to check if a binding for a given type is available without creating and instance of the class (ie so I don't have to make sure those dependencies are there)?


Solution

  • Damn, of course as soon as I posted I found that in the Kernel, there is a GetBindings() method that does pretty much what I need.

    Hope this helps to someone