Browse Source

FormattableString, why are you so cruel to Eastern Europeans?

af/merge-core
Anton Firszov 9 years ago
parent
commit
e6ef197bcb
  1. 10
      tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs

10
tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs

@ -89,6 +89,8 @@ namespace SixLabors.ImageSharp.Tests
return $"{this.GetTestOutputDir()}/{this.TestName}{pixName}{fn}{details}{extension}"; return $"{this.GetTestOutputDir()}/{this.TestName}{pixName}{fn}{details}{extension}";
} }
private static string Inv(FormattableString formattable) => System.FormattableString.Invariant(formattable);
/// <summary> /// <summary>
/// Gets the recommended file name for the output of the test /// Gets the recommended file name for the output of the test
/// </summary> /// </summary>
@ -111,14 +113,16 @@ namespace SixLabors.ImageSharp.Tests
TypeInfo info = type.GetTypeInfo(); TypeInfo info = type.GetTypeInfo();
if (info.IsPrimitive || info.IsEnum || type == typeof(decimal)) if (info.IsPrimitive || info.IsEnum || type == typeof(decimal))
{ {
detailsString = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", testOutputDetails); detailsString = Inv($"{testOutputDetails}");
} }
else else
{ {
IEnumerable<PropertyInfo> properties = testOutputDetails.GetType().GetRuntimeProperties(); IEnumerable<PropertyInfo> properties = testOutputDetails.GetType().GetRuntimeProperties();
detailsString = String.Join( detailsString = string.Join(
"_", properties.ToDictionary(x => x.Name, x => string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", x.GetValue(testOutputDetails))).Select(x => $"{x.Key}-{x.Value}") "_",
properties.ToDictionary(x => x.Name, x => x.GetValue(testOutputDetails))
.Select(x => Inv($"{x.Key}-{x.Value}"))
); );
} }
} }

Loading…
Cancel
Save