Groups
Conversations
All groups and messages
Send feedback to Google
Help
Training
Sign in
Groups
ninject-dev
Conversations
About
Common Service Locator Adapter Does Not Resolve Without a Name
167 views
Skip to first unread message
Thedric Walker
unread,
Jul 23, 2010, 12:23:38 PM
7/23/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninject-dev
The following test currently fails with an Activation Exception:
[Fact]
public ShouldResolveWithoutNameBeingGiven()
{
var kernel = new StandardKernel();
kernel.Bind<IWeapon>.To<Sword>();
var locator = new NinjectServiceLocator(kernel);
var weapon = locator.GetInstance<IWeapon>();
weapon.ShouldNotBeNull();
weapon.ShouldBeInstanceOf<Sword>();
}
The fix is a simple one. Change line 30 of NinjectServiceLocator.cs
to:
return key == null ? Kernel.Get(serviceType) : Kernel.Get(serviceType,
key);
Reply all
Reply to author
Forward
0 new messages