This commit is contained in:
Hao Kung 2016-11-16 15:26:21 -08:00
Родитель 3af7e8b17b
Коммит 2478b73f52
1 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -464,27 +464,6 @@ namespace Microsoft.Extensions.Configuration.Binder.Test
Assert.Equal("Derived:Sup", options.Virtual);
}
[Fact]
public void CanGetComplexOptionsWhichHasAlsoHasValue()
{
var dic = new Dictionary<string, string>
{
{"obj", "whut" },
{"obj:Integer", "-2"},
{"obj:Boolean", "TRUe"},
{"obj:Nested:Integer", "11"}
};
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddInMemoryCollection(dic);
var config = configurationBuilder.Build();
var options = config.GetSection("obj").Get<ComplexOptions>();
Assert.NotNull(options);
Assert.True(options.Boolean);
Assert.Equal(-2, options.Integer);
Assert.Equal(11, options.Nested.Integer);
}
[Fact]
public void GetCanReadStaticProperty()
{
@ -518,6 +497,27 @@ namespace Microsoft.Extensions.Configuration.Binder.Test
Assert.Equal("other stuff", ComplexOptions.StaticProperty);
}
[Fact]
public void CanGetComplexOptionsWhichHasAlsoHasValue()
{
var dic = new Dictionary<string, string>
{
{"obj", "whut" },
{"obj:Integer", "-2"},
{"obj:Boolean", "TRUe"},
{"obj:Nested:Integer", "11"}
};
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddInMemoryCollection(dic);
var config = configurationBuilder.Build();
var options = config.GetSection("obj").Get<ComplexOptions>();
Assert.NotNull(options);
Assert.True(options.Boolean);
Assert.Equal(-2, options.Integer);
Assert.Equal(11, options.Nested.Integer);
}
[Theory]
[InlineData("ReadOnly")]
[InlineData("PrivateSetter")]