Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null should be treated as a valid dependency value when passed to a Nullable<T> parameter #521

Closed
jnm2 opened this issue May 6, 2020 · 0 comments · Fixed by #522
Closed
Milestone

Comments

@jnm2
Copy link
Contributor

jnm2 commented May 6, 2020

Failing test:

[Test]
public void Null_may_be_specified_for_non_optional_System_Nullable_typed_factory_parameter()
{
	Container.Register(
		Component.For<DependencyFromContainer>(),
		Component.For<ComponentWithNonOptionalNullableParameter>(),
		Component.For<ComponentWithNonOptionalNullableParameter.Factory>().AsFactory());

	var factory = Container.Resolve<ComponentWithNonOptionalNullableParameter.Factory>();
	factory.Invoke(nonOptionalNullableParameter: null);
}

public sealed class DependencyFromContainer
{
}

public sealed class ComponentWithNonOptionalNullableParameter
{
	public delegate ComponentWithNonOptionalNullableParameter Factory(int? nonOptionalNullableParameter);

	public ComponentWithNonOptionalNullableParameter(int? nonOptionalNullableParameter, DependencyFromContainer dependencyFromContainer)
	{
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants