container
container copied to clipboard
Method injection fails with Type selectors
Description
When method is selected via provided Types it fails to reinterpret the Type as selector and not as value
To Reproduce
This works just fine:
[TestMethod]
public void Annotation_Optional_WithDefaultInt()
{
// Arrange
Container.RegisterType<Service>(new InjectionMethod(nameof(Service.OptionalDependencyAttributeWithDefaultInt)));
// Act
var result = Container.Resolve<Service>();
// Assert
Assert.AreEqual(result.Called, 12);
Assert.AreEqual(result.Value, Service.DefaultInt);
}
When parameter type is added to properly select the method, it fails:
[TestMethod]
public void Annotation_Optional_WithDefaultInt()
{
// Arrange
Container.RegisterType<Service>(new InjectionMethod(nameof(Service.OptionalDependencyAttributeWithDefaultInt), typeof(int)));
// Act
var result = Container.Resolve<Service>();
// Assert
Assert.AreEqual(result.Called, 12);
Assert.AreEqual(result.Value, Service.DefaultInt);
}