This commit is contained in:
Kiran Challa 2017-03-21 12:17:38 -07:00
Родитель eec454efac
Коммит ee2ca94c5d
7 изменённых файлов: 24 добавлений и 11 удалений

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

@ -18,4 +18,8 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

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

@ -242,7 +242,6 @@ namespace Microsoft.Extensions.Configuration.Binder.Test
Assert.Same(config.GetValue("Object", foo), foo);
}
#if !NETCOREAPP2_0 // TypeConverter doesn't support this on DNXCORE
[Fact]
public void GetUri()
{
@ -258,7 +257,6 @@ namespace Microsoft.Extensions.Configuration.Binder.Test
Assert.Equal("http://www.bing.com", uri.OriginalString);
}
#endif
[Theory]
[InlineData("2147483647", typeof(int))]
@ -277,9 +275,7 @@ namespace Microsoft.Extensions.Configuration.Binder.Test
[InlineData("2015-12-24T07:34:42-5:00", typeof(DateTime))]
[InlineData("12/24/2015 13:44:55 +4", typeof(DateTimeOffset))]
[InlineData("99.22:22:22.1234567", typeof(TimeSpan))]
#if !NETCOREAPP2_0 // TypeConverter doesn't support this on DNXCORE
[InlineData("http://www.bing.com", typeof(Uri))]
#endif
// enum test
[InlineData("Constructor", typeof(AttributeTargets))]
[InlineData("CA761232-ED42-11CE-BACD-00AA0057B223", typeof(Guid))]

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

@ -46,9 +46,11 @@ namespace Microsoft.Extensions.Configuration.Json
#if NETCOREAPP2_0
expectedPath = AppContext.BaseDirectory;
#else
#elif NET452
expectedPath = Path.GetFullPath(AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") as string ??
AppDomain.CurrentDomain.BaseDirectory);
#else
#error Target framework needs to be updated
#endif
Assert.NotNull(physicalProvider);

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

@ -25,7 +25,7 @@ i=ini_i.i.i.i
<address name=""4"">xml_4.4.4.4</address>
<address name=""1"">xml_1.1.1.1</address>
<address name=""x"">xml_x.x.x.x</address>
</settings>
</settings>
";
private static readonly string _json1ConfigFileContent = @"
{
@ -105,8 +105,10 @@ i=ini_i.i.i.i
var basePath = AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") as string ??
AppDomain.CurrentDomain.BaseDirectory ??
string.Empty;
#else
#elif NETCOREAPP2_0
var basePath = AppContext.BaseDirectory ?? string.Empty;
#else
#error Target framework needs to be updated
#endif
_iniConfigFilePath = Path.GetRandomFileName();
_xmlConfigFilePath = Path.GetRandomFileName();
@ -118,7 +120,7 @@ i=ini_i.i.i.i
File.WriteAllText(Path.Combine(basePath, _json1ConfigFilePath), _json1ConfigFileContent);
File.WriteAllText(Path.Combine(basePath, _json2ConfigFilePath), _json2ConfigFileContent);
}
public void Dispose()
{
File.Delete(_iniConfigFilePath);

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

@ -82,8 +82,10 @@ CommonKey3:CommonKey4=IniValue6";
_basePath = AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") as string ??
AppDomain.CurrentDomain.BaseDirectory ??
string.Empty;
#else
#elif NETCOREAPP2_0
_basePath = AppContext.BaseDirectory ?? string.Empty;
#else
#error Target framework needs to be updated
#endif
_iniFile = Path.GetRandomFileName();
@ -484,7 +486,8 @@ IniKey1=IniValue2");
};
CreateBuilder()
.AddJsonFile(s => {
.AddJsonFile(s =>
{
s.Path = "error.json";
s.OnLoadException = jsonLoadError;
})

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

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if !NETCOREAPP2_0
#if NET452
// These tests only run on desktop CLR.
using System;
@ -70,4 +70,7 @@ namespace Microsoft.Extensions.Configuration.Xml.Test
}
}
}
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif

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

@ -54,4 +54,7 @@ namespace Microsoft.Extensions.Configuration.Xml.Test
}
}
}
#elif NET452
#else
#error Target framework needs to be updated
#endif