Why can't I inject value null with Ninjects ConstructorArgument?
- by stiank81
When using Ninjects ConstructorArgument you can specify the exact value to inject to specific parameters. Why can't this value be null, or how can I make it work? Maybe it's not something you'd like to do, but I want to use it in my unit tests.. Example:
public class Ninja
{
private readonly IWeapon _weapon;
public Ninja(IWeapon weapon)
{
_weapon = weapon;
}
}
public void SomeFunction()
{
var kernel = new StandardKernel();
var ninja = kernel.Get<Ninja>(new ConstructorArgument("weapon", null));
}