Skip to content

Commit

Permalink
Added failing test for issue autofac#789.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Illig committed Aug 19, 2016
1 parent 911ba4b commit 50a0dd0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/Autofac.Test/Builder/PropertyInjectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,5 +625,29 @@ private class WithPropInjection

public string GetProp2() => Prop2;
}

[Fact]
public void TypedParameterForConstructorShouldNotAttachToProperty()
{
// Issue #789
var cb = new ContainerBuilder();
cb.RegisterType<ConstructorParamNotAttachedToProperty>();
var container = cb.Build();
var resolved = container.Resolve<ConstructorParamNotAttachedToProperty>(TypedParameter.From("test"));
Assert.Equal("test", resolved._id);
Assert.Null(resolved.Name);
}

private class ConstructorParamNotAttachedToProperty
{
public ConstructorParamNotAttachedToProperty(string id)
{
this._id = id;
}

public string _id = null;

public string Name { get; set; }
}
}
}

0 comments on commit 50a0dd0

Please sign in to comment.