Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Maltsev <fire.alkazar@gmail.com>2017-02-07 21:03:07 +0300
committerDan Moseley <danmose@microsoft.com>2017-02-07 21:03:07 +0300
commitcfed28ccb666fdf99cf45600f03c826c133f6567 (patch)
tree73b86fc49d8969104fc3137bf06c2b4832d6cfbb
parent0e3fe2d4e207067d427f301b4533acb3e1c8c9f5 (diff)
Add tests for System.Configuration.UriSection (#15832)
-rw-r--r--src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj1
-rw-r--r--src/System.Configuration.ConfigurationManager/tests/System/Configuration/UriSectionTests.cs53
2 files changed, 54 insertions, 0 deletions
diff --git a/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj b/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
index 64778030fa..1c93fe47e9 100644
--- a/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
+++ b/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
@@ -90,6 +90,7 @@
<Compile Include="System\Configuration\TempConfig.cs" />
<Compile Include="System\Configuration\TestData.cs" />
<Compile Include="System\Configuration\TypeUtilTests.cs" />
+ <Compile Include="System\Configuration\UriSectionTests.cs" />
<Compile Include="System\Configuration\ValidatiorUtilsTests.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/src/System.Configuration.ConfigurationManager/tests/System/Configuration/UriSectionTests.cs b/src/System.Configuration.ConfigurationManager/tests/System/Configuration/UriSectionTests.cs
new file mode 100644
index 0000000000..d63ea2ebb8
--- /dev/null
+++ b/src/System.Configuration.ConfigurationManager/tests/System/Configuration/UriSectionTests.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Configuration;
+using Xunit;
+
+namespace System.ConfigurationTests
+{
+ public class UriSectionTests
+ {
+ public static string UriSectionConfiguration =
+@"<?xml version='1.0' encoding='utf-8' ?>
+<configuration>
+ <configSections>
+ <section name='uri' type='System.Configuration.UriSection, System' />
+ </configSections>
+ <uri>
+ <idn enabled='All' />
+ <iriParsing enabled='true' />
+ <schemeSettings>
+ <add name='ftp' genericUriParserOptions='DontCompressPath' />
+ </schemeSettings>
+ </uri>
+</configuration>";
+
+ [Fact]
+ public void UriSectionIdnIriParsing()
+ {
+ using (var temp = new TempConfig(UriSectionConfiguration))
+ {
+ var config = ConfigurationManager.OpenExeConfiguration(temp.ExePath);
+ UriSection uriSection = (UriSection)config.GetSection("uri");
+ Assert.Equal(UriIdnScope.All, uriSection.Idn.Enabled);
+ Assert.Equal(true, uriSection.IriParsing.Enabled);
+ }
+ }
+
+ [Fact]
+ public void UriSectionSchemeSettings()
+ {
+ using (var temp = new TempConfig(UriSectionConfiguration))
+ {
+ var config = ConfigurationManager.OpenExeConfiguration(temp.ExePath);
+ UriSection uriSection = (UriSection)config.GetSection("uri");
+ Assert.Equal(1, uriSection.SchemeSettings.Count);
+ SchemeSettingElement schemeSettingElement = uriSection.SchemeSettings[0];
+ Assert.Equal("ftp", schemeSettingElement.Name);
+ Assert.Equal(GenericUriParserOptions.DontCompressPath, schemeSettingElement.GenericUriParserOptions);
+ }
+ }
+ }
+} \ No newline at end of file