-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #26: Type conversion now uses invariant culture.
- Loading branch information
Showing
5 changed files
with
192 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 96 additions & 96 deletions
192
test/Autofac.Configuration.Test/Files/ConfigurationExtensions_EnumerableParameters.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,96 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<autofac defaultAssembly="Autofac.Configuration.Test"> | ||
<components name="0"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+A</type> | ||
<properties> | ||
<List name="0">Val1</List> | ||
<List name="1">Val2</List> | ||
</properties> | ||
</components> | ||
<components name="1"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+B</type> | ||
<properties> | ||
<List name="0">1</List> | ||
<List name="1">2</List> | ||
</properties> | ||
</components> | ||
<components name="2"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+C</type> | ||
<properties> | ||
<List name="0">1</List> | ||
<List name="1">2</List> | ||
</properties> | ||
</components> | ||
<components name="3"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+D</type> | ||
<properties> | ||
<Num>123</Num> | ||
</properties> | ||
</components> | ||
<components name="4"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+E</type> | ||
<parameters> | ||
<List name="0">1</List> | ||
<List name="1">2</List> | ||
</parameters> | ||
</components> | ||
<!-- | ||
Microsoft.Extensions.Configuration ignores empty elements so you | ||
don't know the difference between null and empty. | ||
<components name="5"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+F</type> | ||
<properties> | ||
<List /> | ||
</properties> | ||
</components> | ||
--> | ||
<components name="6"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+G</type> | ||
<properties> | ||
<Enumerable name="0">Val1</Enumerable> | ||
<Enumerable name="1">Val2</Enumerable> | ||
</properties> | ||
</components> | ||
<components name="7"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+H</type> | ||
<properties> | ||
<Enumerable name="0">1</Enumerable> | ||
<Enumerable name="1">2</Enumerable> | ||
</properties> | ||
</components> | ||
<components name="8"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+I</type> | ||
<properties> | ||
<Collection name="0">1</Collection> | ||
<Collection name="1">2</Collection> | ||
</properties> | ||
</components> | ||
<components name="9"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+J</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="10"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+K</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="11"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+L</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="12"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+M</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list>Val2</list> <!-- no name --> | ||
</parameters> | ||
</components> | ||
</autofac> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<autofac defaultAssembly="Autofac.Configuration.Test"> | ||
<components name="0"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+A</type> | ||
<properties> | ||
<List name="0">Val1</List> | ||
<List name="1">Val2</List> | ||
</properties> | ||
</components> | ||
<components name="1"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+B</type> | ||
<properties> | ||
<List name="0">1.234</List> | ||
<List name="1">2.345</List> | ||
</properties> | ||
</components> | ||
<components name="2"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+C</type> | ||
<properties> | ||
<List name="0">1.234</List> | ||
<List name="1">2.345</List> | ||
</properties> | ||
</components> | ||
<components name="3"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+D</type> | ||
<properties> | ||
<Num>123.456</Num> | ||
</properties> | ||
</components> | ||
<components name="4"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+E</type> | ||
<parameters> | ||
<List name="0">1.234</List> | ||
<List name="1">2.345</List> | ||
</parameters> | ||
</components> | ||
<!-- | ||
Microsoft.Extensions.Configuration ignores empty elements so you | ||
don't know the difference between null and empty. | ||
<components name="5"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+F</type> | ||
<properties> | ||
<List /> | ||
</properties> | ||
</components> | ||
--> | ||
<components name="6"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+G</type> | ||
<properties> | ||
<Enumerable name="0">Val1</Enumerable> | ||
<Enumerable name="1">Val2</Enumerable> | ||
</properties> | ||
</components> | ||
<components name="7"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+H</type> | ||
<properties> | ||
<Enumerable name="0">1.234</Enumerable> | ||
<Enumerable name="1">2.345</Enumerable> | ||
</properties> | ||
</components> | ||
<components name="8"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+I</type> | ||
<properties> | ||
<Collection name="0">1.234</Collection> | ||
<Collection name="1">2.345</Collection> | ||
</properties> | ||
</components> | ||
<components name="9"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+J</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="10"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+K</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="11"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+L</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list name="1">Val2</list> | ||
</parameters> | ||
</components> | ||
<components name="12"> | ||
<type>Autofac.Configuration.Test.Core.ConfigurationExtensions_EnumerableParametersFixture+M</type> | ||
<parameters> | ||
<list name="0">Val1</list> | ||
<list>Val2</list> <!-- no name --> | ||
</parameters> | ||
</components> | ||
</autofac> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Threading; | ||
using Xunit; | ||
|
||
namespace Autofac.Configuration.Test | ||
{ | ||
public static class TestCulture | ||
{ | ||
public static void With(CultureInfo culture, Action test) | ||
{ | ||
var originalCulture = Thread.CurrentThread.CurrentCulture; | ||
var originalUICulture = Thread.CurrentThread.CurrentUICulture; | ||
Thread.CurrentThread.CurrentCulture = culture; | ||
Thread.CurrentThread.CurrentUICulture = culture; | ||
CultureInfo.CurrentCulture.ClearCachedData(); | ||
CultureInfo.CurrentUICulture.ClearCachedData(); | ||
try | ||
{ | ||
test(); | ||
} | ||
finally | ||
{ | ||
Thread.CurrentThread.CurrentCulture = originalCulture; | ||
Thread.CurrentThread.CurrentUICulture = originalUICulture; | ||
CultureInfo.CurrentCulture.ClearCachedData(); | ||
CultureInfo.CurrentUICulture.ClearCachedData(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters