|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 |
|
| 4 | +using System.Collections.Generic; |
4 | 5 | using System.Globalization; |
5 | 6 | using Xunit; |
6 | 7 |
|
@@ -106,15 +107,24 @@ public void EmptyInputIsInvalid() |
106 | 107 | Assert.Throws<ArgumentException>(() => AssemblyNameInfo.Parse("".AsSpan())); |
107 | 108 | } |
108 | 109 |
|
109 | | - [Fact] |
110 | | - public void CultureNameGetLoweredByToAssemblyName() |
| 110 | + |
| 111 | + public static IEnumerable<object[]> CultureNameGetLoweredByToAssemblyName_Arguments() |
| 112 | + { |
| 113 | + yield return new object[] { "aA", "aa" }; |
| 114 | + yield return new object[] { "B-BB", PlatformDetection.IsNetFramework ? "B-BB" : "b-BB" }; |
| 115 | + } |
| 116 | + |
| 117 | + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] |
| 118 | + [MemberData(nameof(CultureNameGetLoweredByToAssemblyName_Arguments))] |
| 119 | + public void CultureNameGetLoweredByToAssemblyName(string input, string expected) |
111 | 120 | { |
112 | | - AssemblyNameInfo assemblyNameInfo = AssemblyNameInfo.Parse("test,culture=aA".AsSpan()); |
113 | | - Assert.Equal("aA", assemblyNameInfo.CultureName); |
| 121 | + AssemblyNameInfo assemblyNameInfo = AssemblyNameInfo.Parse($"test,culture={input}".AsSpan()); |
| 122 | + Assert.Equal(input, assemblyNameInfo.CultureName); |
114 | 123 | // When converting to AssemblyName, the culture name is lower-cased |
115 | 124 | // by the CultureInfo ctor that calls CultureData.GetCultureData |
116 | 125 | // which lowers the name for caching and normalization purposes. |
117 | | - Assert.Equal("aa", assemblyNameInfo.ToAssemblyName().CultureName); |
| 126 | + // It lowers only the part before the `-` character. |
| 127 | + Assert.Equal(expected, assemblyNameInfo.ToAssemblyName().CultureName); |
118 | 128 | } |
119 | 129 |
|
120 | 130 | [Theory] |
|
0 commit comments