Skip to content

Commit

Permalink
First pass at adding a test to reproduce the problem. (dotnet#77693)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDunn authored Nov 1, 2022
1 parent 6773982 commit 5333727
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,25 @@ public enum TestSettingsEnum
Option2,
}

public record RootConfig(NestedConfig Nested);

public record NestedConfig(string MyProp);

[Fact]
public void BindWithNestedTypesWithReadOnlyProperties()
{
IConfiguration configuration = new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
{ "Nested:MyProp", "Dummy" }
})
.Build();

var result = configuration.Get<RootConfig>();

Assert.Equal("Dummy", result.Nested.MyProp);
}

[Fact]
public void EnumBindCaseInsensitiveNotThrows()
{
Expand Down

0 comments on commit 5333727

Please sign in to comment.