diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index 78821aac1..7821d0b51 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -19,13 +19,14 @@ namespace SixLabors.ImageSharp.Tests this.Width = width; this.Height = height; } + public BlankProvider() { this.Width = 100; this.Height = 100; } - public override string SourceFileOrDescription => $"Blank{this.Width}x{this.Height}"; + public override string SourceFileOrDescription => TestUtils.AsInvariantString($"Blank{this.Width}x{this.Height}"); protected int Height { get; private set; } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs index df5b424a2..70e762585 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs @@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Tests } public override string SourceFileOrDescription - => $"Solid{this.Width}x{this.Height}_({this.r},{this.g},{this.b},{this.a})"; + => TestUtils.AsInvariantString($"Solid{this.Width}x{this.Height}_({this.r},{this.g},{this.b},{this.a})"); public override Image GetImage() { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs index 0b25991ff..f04f891f8 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs @@ -30,7 +30,7 @@ namespace SixLabors.ImageSharp.Tests { } - public override string SourceFileOrDescription => $"TestPattern{this.Width}x{this.Height}"; + public override string SourceFileOrDescription => TestUtils.AsInvariantString($"TestPattern{this.Width}x{this.Height}"); public override Image GetImage() { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs index 340fc600a..02f8ddd7e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -95,8 +95,6 @@ namespace SixLabors.ImageSharp.Tests return $"{this.GetTestOutputDir()}/{this.TestName}{pixName}{fn}{details}{extension}"; } - private static string Inv(FormattableString formattable) => System.FormattableString.Invariant(formattable); - /// /// Gets the recommended file name for the output of the test /// @@ -123,7 +121,7 @@ namespace SixLabors.ImageSharp.Tests TypeInfo info = type.GetTypeInfo(); if (info.IsPrimitive || info.IsEnum || type == typeof(decimal)) { - detailsString = Inv($"{testOutputDetails}"); + detailsString = TestUtils.AsInvariantString($"{testOutputDetails}"); } else { @@ -132,7 +130,7 @@ namespace SixLabors.ImageSharp.Tests detailsString = string.Join( "_", properties.ToDictionary(x => x.Name, x => x.GetValue(testOutputDetails)) - .Select(x => Inv($"{x.Key}-{x.Value}")) + .Select(x => TestUtils.AsInvariantString($"{x.Key}-{x.Value}")) ); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs index 85729acd3..f71793ff2 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs @@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Tests public static string ToCsv(this IEnumerable items, string separator = ",") { - return string.Join(separator, items.Select(o => string.Format(CultureInfo.InvariantCulture, "{0}", o))); + return String.Join(separator, items.Select(o => String.Format(CultureInfo.InvariantCulture, "{0}", o))); } public static Type GetClrType(this PixelTypes pixelType) => PixelTypes2ClrTypes[pixelType]; @@ -227,5 +227,7 @@ namespace SixLabors.ImageSharp.Tests image.DebugSave(provider, testOutputDetails); } } + + public static string AsInvariantString(this FormattableString formattable) => System.FormattableString.Invariant(formattable); } } \ No newline at end of file