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

Loading…
Cancel
Save