duplicated test method in ConfigurationBinderTests
yuniansheng opened this issue · comments
The two test method in Microsoft.Extensions.Configuration.Binder.Test.ConfigurationBinderTests are the same, i guess the original intention for GetCanReadComplexProperties should be testing the config.Get method. GetCanReadInheritedProperties and GetCanReadStaticProperty in this class also have the same problem.
[Fact]
public void BindCanReadComplexProperties()
{
var dic = new Dictionary<string, string>
{
{"Integer", "-2"},
{"Boolean", "TRUe"},
{"Nested:Integer", "11"}
};
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddInMemoryCollection(dic);
var config = configurationBuilder.Build();
var instance = new ComplexOptions();
config.Bind(instance);
Assert.True(instance.Boolean);
Assert.Equal(-2, instance.Integer);
Assert.Equal(11, instance.Nested.Integer);
}
[Fact]
public void GetCanReadComplexProperties()
{
var dic = new Dictionary<string, string>
{
{"Integer", "-2"},
{"Boolean", "TRUe"},
{"Nested:Integer", "11"}
};
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddInMemoryCollection(dic);
var config = configurationBuilder.Build();
// here is same with BindCanReadComplexProperties, according to the test method name i think it should be like this
// var options = config.Get<ComplexOptions>();
var options = new ComplexOptions();
config.Bind(options);
Assert.True(options.Boolean);
Assert.Equal(-2, options.Integer);
Assert.Equal(11, options.Nested.Integer);
}
Thanks i'll fix the test
Engineering triage decision: this does not appear to be high priority, and we do not plan to address this.