From 29ff120273942988de4c8ee1b9ca75034498e923 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Thu, 21 May 2026 19:16:57 +0200 Subject: [PATCH] Fix xunit skip when used in nameof it is not allowed to be a filed it must be a property --- .../UniformUnmanagedMemoryPoolTests.Trim.cs | 47 ++++++++---- .../UniformUnmanagedMemoryPoolTests.cs | 74 ++++++++++++------- .../TestUtilities/TestEnvironment.cs | 60 ++++++++++----- .../Tests/BasicSerializerTests.cs | 22 ++++-- .../Tests/TestEnvironmentTests.cs | 53 ++++++++----- 5 files changed, 167 insertions(+), 89 deletions(-) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs index fbb12babdf..453b0ed036 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs @@ -14,9 +14,7 @@ public partial class UniformUnmanagedMemoryPoolTests public class Trim { [CollectionDefinition(nameof(NonParallelTests), DisableParallelization = true)] - public class NonParallelTests - { - } + public class NonParallelTests { } [Fact] public void TrimPeriodElapsed_TrimsHalfOfUnusedArrays() @@ -24,7 +22,10 @@ public partial class UniformUnmanagedMemoryPoolTests RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 5_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() + { + TrimPeriodMilliseconds = 5_000, + }; UniformUnmanagedMemoryPool pool = new(128, 256, trimSettings); UnmanagedMemoryHandle[] a = pool.Rent(64); @@ -37,7 +38,8 @@ public partial class UniformUnmanagedMemoryPoolTests // 128 - 32 - 16 = 80 Assert.True( UnmanagedMemoryHandle.TotalOutstandingHandles <= 80, - $"UnmanagedMemoryHandle.TotalOutstandingHandles={UnmanagedMemoryHandle.TotalOutstandingHandles} > 80"); + $"UnmanagedMemoryHandle.TotalOutstandingHandles={UnmanagedMemoryHandle.TotalOutstandingHandles} > 80" + ); pool.Return(b); } } @@ -46,14 +48,12 @@ public partial class UniformUnmanagedMemoryPoolTests // MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed, // which is strongly timing-sensitive, and might be flaky under high load. [CollectionDefinition(nameof(NonParallelCollection), DisableParallelization = true)] - public class NonParallelCollection - { - } + public class NonParallelCollection { } [Collection(nameof(NonParallelCollection))] public class NonParallel { - public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; + public static bool IsNotMacOS => !TestEnvironment.IsMacOS; // TODO: Investigate failures on macOS. All handles are released after GC. // (It seems to happen more consistently on .NET 6.) @@ -77,10 +77,16 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings1 = new() { TrimPeriodMilliseconds = 6_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings1 = new() + { + TrimPeriodMilliseconds = 6_000, + }; UniformUnmanagedMemoryPool pool1 = new(128, 256, trimSettings1); Thread.Sleep(8_000); // Let some callbacks fire already - UniformUnmanagedMemoryPool.TrimSettings trimSettings2 = new() { TrimPeriodMilliseconds = 3_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings2 = new() + { + TrimPeriodMilliseconds = 3_000, + }; UniformUnmanagedMemoryPool pool2 = new(128, 256, trimSettings2); pool1.Return(pool1.Rent(64)); @@ -96,7 +102,8 @@ public partial class UniformUnmanagedMemoryPoolTests Thread.Sleep(15_000); Assert.True( UnmanagedMemoryHandle.TotalOutstandingHandles <= 64, - $"UnmanagedMemoryHandle.TotalOutstandingHandles={UnmanagedMemoryHandle.TotalOutstandingHandles} > 64"); + $"UnmanagedMemoryHandle.TotalOutstandingHandles={UnmanagedMemoryHandle.TotalOutstandingHandles} > 64" + ); GC.KeepAlive(pool1); GC.KeepAlive(pool2); } @@ -104,13 +111,16 @@ public partial class UniformUnmanagedMemoryPoolTests [MethodImpl(MethodImplOptions.NoInlining)] static void LeakPoolInstance() { - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 4_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() + { + TrimPeriodMilliseconds = 4_000, + }; _ = new UniformUnmanagedMemoryPool(128, 256, trimSettings); } } } - public static readonly bool Is32BitProcess = !Environment.Is64BitProcess; + public static bool Is32BitProcess => !Environment.Is64BitProcess; private static readonly List PressureArrays = []; [Fact] @@ -129,11 +139,16 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.False(Environment.Is64BitProcess); const int oneMb = 1 << 20; - UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { HighPressureThresholdRate = 0.2f }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() + { + HighPressureThresholdRate = 0.2f, + }; GCMemoryInfo memInfo = GC.GetGCMemoryInfo(); int highLoadThreshold = (int)(memInfo.HighMemoryLoadThresholdBytes / oneMb); - highLoadThreshold = (int)(trimSettings.HighPressureThresholdRate * highLoadThreshold); + highLoadThreshold = (int)( + trimSettings.HighPressureThresholdRate * highLoadThreshold + ); UniformUnmanagedMemoryPool pool = new(oneMb, 16, trimSettings); pool.Return(pool.Rent(16)); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs index 3c4472bc9d..7e9e8294fc 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs @@ -27,11 +27,13 @@ public partial class UniformUnmanagedMemoryPoolTests public void Register(UnmanagedMemoryHandle handle) => this.handlesToDestroy.Add(handle); - public void Register(IEnumerable handles) => this.handlesToDestroy.AddRange(handles); + public void Register(IEnumerable handles) => + this.handlesToDestroy.AddRange(handles); public void Register(IntPtr memoryPtr) => this.ptrsToDestroy.Add(memoryPtr); - public void Register(IEnumerable memoryPtrs) => this.ptrsToDestroy.AddRange(memoryPtrs); + public void Register(IEnumerable memoryPtrs) => + this.ptrsToDestroy.AddRange(memoryPtrs); public void Dispose() { @@ -93,7 +95,11 @@ public partial class UniformUnmanagedMemoryPoolTests } } - private static void CheckBuffer(int length, UniformUnmanagedMemoryPool pool, UnmanagedMemoryHandle h) + private static void CheckBuffer( + int length, + UniformUnmanagedMemoryPool pool, + UnmanagedMemoryHandle h + ) { Assert.False(h.IsInvalid); Span span = GetSpan(h, pool.BufferLength); @@ -104,7 +110,8 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.True(span.SequenceEqual(expected)); } - private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => new(h.Pointer, length); + private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => + new(h.Pointer, length); [Theory] [InlineData(1, 1)] @@ -209,7 +216,11 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(0, 6, 5)] [InlineData(5, 1, 5)] [InlineData(4, 7, 10)] - public void Rent_MultiBuffer_OverCapacity_ReturnsNull(int initialRent, int attempt, int capacity) + public void Rent_MultiBuffer_OverCapacity_ReturnsNull( + int initialRent, + int attempt, + int capacity + ) { UniformUnmanagedMemoryPool pool = new(128, capacity); using CleanupUtil cleanup = new(pool); @@ -237,7 +248,7 @@ public partial class UniformUnmanagedMemoryPoolTests cleanup.Register(b1); } - public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS; + public static bool IsNotMacOS => !TestEnvironment.IsMacOS; // TODO: Investigate macOS failures [Theory(Skip = "Skipped on macOS", SkipUnless = nameof(IsNotMacOS))] @@ -260,7 +271,10 @@ public partial class UniformUnmanagedMemoryPoolTests pool.Release(); // Do some unmanaged allocations to make sure new pool buffers are different: - IntPtr[] dummy = Enumerable.Range(0, 100).Select(_ => Marshal.AllocHGlobal(16)).ToArray(); + IntPtr[] dummy = Enumerable + .Range(0, 100) + .Select(_ => Marshal.AllocHGlobal(16)) + .ToArray(); cleanup.Register(dummy); if (bool.Parse(multipleInner)) @@ -309,34 +323,38 @@ public partial class UniformUnmanagedMemoryPoolTests using CleanupUtil cleanup = new(pool); Random rnd = new(0); - Parallel.For(0, Environment.ProcessorCount, (int i) => - { - List allHandles = new(); - int pauseAt = rnd.Next(100); - for (int j = 0; j < 100; j++) + Parallel.For( + 0, + Environment.ProcessorCount, + (int i) => { - UnmanagedMemoryHandle[] data = pool.Rent(2); + List allHandles = new(); + int pauseAt = rnd.Next(100); + for (int j = 0; j < 100; j++) + { + UnmanagedMemoryHandle[] data = pool.Rent(2); - GetSpan(data[0], pool.BufferLength).Fill((byte)i); - GetSpan(data[1], pool.BufferLength).Fill((byte)i); - allHandles.Add(data[0]); - allHandles.Add(data[1]); + GetSpan(data[0], pool.BufferLength).Fill((byte)i); + GetSpan(data[1], pool.BufferLength).Fill((byte)i); + allHandles.Add(data[0]); + allHandles.Add(data[1]); - if (j == pauseAt) - { - Thread.Sleep(15); + if (j == pauseAt) + { + Thread.Sleep(15); + } } - } - Span expected = new byte[8]; - expected.Fill((byte)i); + Span expected = new byte[8]; + expected.Fill((byte)i); - foreach (UnmanagedMemoryHandle h in allHandles) - { - Assert.True(expected.SequenceEqual(GetSpan(h, pool.BufferLength))); - pool.Return(new[] { h }); + foreach (UnmanagedMemoryHandle h in allHandles) + { + Assert.True(expected.SequenceEqual(GetSpan(h, pool.BufferLength))); + pool.Return(new[] { h }); + } } - }); + ); } [Theory] diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs index 5eb5be0d9a..eafb2e781c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs @@ -15,11 +15,14 @@ public static partial class TestEnvironment private const string ActualOutputDirectoryRelativePath = @"tests\Images\ActualOutput"; - private const string ReferenceOutputDirectoryRelativePath = @"tests\Images\External\ReferenceOutput"; + private const string ReferenceOutputDirectoryRelativePath = + @"tests\Images\External\ReferenceOutput"; private const string ToolsDirectoryRelativePath = @"tests\Images\External\tools"; - private static readonly Lazy SolutionDirectoryFullPathLazy = new(GetSolutionDirectoryFullPathImpl); + private static readonly Lazy SolutionDirectoryFullPathLazy = new( + GetSolutionDirectoryFullPathImpl + ); private static readonly Lazy NetCoreVersionLazy = new(GetNetCoreVersion); @@ -52,7 +55,9 @@ public static partial class TestEnvironment internal static string SolutionDirectoryFullPath => SolutionDirectoryFullPathLazy.Value; - private static readonly FileInfo TestAssemblyFile = new(typeof(TestEnvironment).GetTypeInfo().Assembly.Location); + private static readonly FileInfo TestAssemblyFile = new( + typeof(TestEnvironment).GetTypeInfo().Assembly.Location + ); private static string GetSolutionDirectoryFullPathImpl() { @@ -68,12 +73,15 @@ public static partial class TestEnvironment { throw new DirectoryNotFoundException( $"Unable to find ImageSharp solution directory from {TestAssemblyFile} because of {ex.GetType().Name}!", - ex); + ex + ); } if (directory == null) { - throw new DirectoryNotFoundException($"Unable to find ImageSharp solution directory from {TestAssemblyFile}!"); + throw new DirectoryNotFoundException( + $"Unable to find ImageSharp solution directory from {TestAssemblyFile}!" + ); } } @@ -82,7 +90,7 @@ public static partial class TestEnvironment private static string GetFullPath(string relativePath) => Path.Combine(SolutionDirectoryFullPath, relativePath) - .Replace('\\', Path.DirectorySeparatorChar); + .Replace('\\', Path.DirectorySeparatorChar); /// /// Gets the correct full path to the Input Images directory. @@ -92,17 +100,21 @@ public static partial class TestEnvironment /// /// Gets the correct full path to the Actual Output directory. (To be written to by the test cases.) /// - internal static string ActualOutputDirectoryFullPath => GetFullPath(ActualOutputDirectoryRelativePath); + internal static string ActualOutputDirectoryFullPath => + GetFullPath(ActualOutputDirectoryRelativePath); /// /// Gets the correct full path to the Expected Output directory. (To compare the test results to.) /// - internal static string ReferenceOutputDirectoryFullPath => GetFullPath(ReferenceOutputDirectoryRelativePath); + internal static string ReferenceOutputDirectoryFullPath => + GetFullPath(ReferenceOutputDirectoryRelativePath); internal static string ToolsDirectoryFullPath => GetFullPath(ToolsDirectoryRelativePath); internal static string GetReferenceOutputFileName(string actualOutputFileName) => - actualOutputFileName.Replace("ActualOutput", @"External\ReferenceOutput").Replace('\\', Path.DirectorySeparatorChar); + actualOutputFileName + .Replace("ActualOutput", @"External\ReferenceOutput") + .Replace('\\', Path.DirectorySeparatorChar); internal static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); @@ -110,7 +122,7 @@ public static partial class TestEnvironment internal static bool IsMono => Type.GetType("Mono.Runtime") != null; // https://stackoverflow.com/a/721194 - internal static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + public static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); internal static bool Is64BitProcess => IntPtr.Size == 8; @@ -123,9 +135,7 @@ public static partial class TestEnvironment /// /// A dummy operation to enforce the execution of the static constructor. /// - internal static void EnsureSharedInitializersDone() - { - } + internal static void EnsureSharedInitializersDone() { } /// /// Creates the image output directory. @@ -164,8 +174,10 @@ public static partial class TestEnvironment return; } - string remoteExecutorConfigPath = - Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe.config"); + string remoteExecutorConfigPath = Path.Combine( + TestAssemblyFile.DirectoryName, + "Microsoft.DotNet.RemoteExecutor.exe.config" + ); if (File.Exists(remoteExecutorConfigPath)) { @@ -196,11 +208,15 @@ public static partial class TestEnvironment string windowsSdksDir = Path.Combine( Environment.GetEnvironmentVariable("PROGRAMFILES(x86)"), "Microsoft SDKs", - "Windows"); + "Windows" + ); FileInfo corFlagsFile = Find(new DirectoryInfo(windowsSdksDir), "CorFlags.exe"); - string remoteExecutorPath = Path.Combine(TestAssemblyFile.DirectoryName, "Microsoft.DotNet.RemoteExecutor.exe"); + string remoteExecutorPath = Path.Combine( + TestAssemblyFile.DirectoryName, + "Microsoft.DotNet.RemoteExecutor.exe" + ); string remoteExecutorTmpPath = $"{remoteExecutorPath}._tmp"; @@ -220,7 +236,7 @@ public static partial class TestEnvironment Arguments = args, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, }; using Process proc = Process.Start(si); @@ -231,7 +247,8 @@ public static partial class TestEnvironment if (proc.ExitCode != 0) { throw new Exception( - $@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}"); + $@"Failed to run {si.FileName} {si.Arguments}:\n STDOUT: {standardOutput}\n STDERR: {standardError}" + ); } File.Delete(remoteExecutorPath); @@ -265,7 +282,10 @@ public static partial class TestEnvironment private static Version GetNetCoreVersion() { Assembly assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; - string[] assemblyPath = assembly.Location.Split(['/', '\\'], StringSplitOptions.RemoveEmptyEntries); + string[] assemblyPath = assembly.Location.Split( + ['/', '\\'], + StringSplitOptions.RemoveEmptyEntries + ); int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) { diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs index 4e9ca2bc2a..2f0e73f20c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs @@ -18,16 +18,16 @@ public class BasicSerializerTests public virtual void Deserialize(IXunitSerializationInfo info) { - info.AddValue(nameof(this.Length), this.Length); - info.AddValue(nameof(this.Name), this.Name); - info.AddValue(nameof(this.Lives), this.Lives); + this.Length = info.GetValue(nameof(this.Length)); + this.Name = info.GetValue(nameof(this.Name)); + this.Lives = info.GetValue(nameof(this.Lives)); } public virtual void Serialize(IXunitSerializationInfo info) { - this.Length = info.GetValue(nameof(this.Length)); - this.Name = info.GetValue(nameof(this.Name)); - this.Lives = info.GetValue(nameof(this.Lives)); + info.AddValue(nameof(this.Length), this.Length); + info.AddValue(nameof(this.Name), this.Name); + info.AddValue(nameof(this.Lives), this.Lives); } } @@ -37,8 +37,8 @@ public class BasicSerializerTests public override void Deserialize(IXunitSerializationInfo info) { - this.Strength = info.GetValue(nameof(this.Strength)); base.Deserialize(info); + this.Strength = info.GetValue(nameof(this.Strength)); } public override void Serialize(IXunitSerializationInfo info) @@ -51,7 +51,13 @@ public class BasicSerializerTests [Fact] public void SerializeDeserialize_ShouldPreserveValues() { - DerivedObj obj = new() { Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8 }; + DerivedObj obj = new() + { + Length = 123.1, + Name = "Lol123!", + Lives = 7, + Strength = 4.8, + }; string str = BasicSerializer.Serialize(obj); BaseObj mirrorBase = BasicSerializer.Deserialize(str); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index 90bd8f939b..4dea89993a 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -2,7 +2,6 @@ // Licensed under the Six Labors Split License. using Microsoft.DotNet.RemoteExecutor; - using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Gif; @@ -15,8 +14,7 @@ namespace SixLabors.ImageSharp.Tests; public class TestEnvironmentTests { - public TestEnvironmentTests(ITestOutputHelper output) - => this.Output = output; + public TestEnvironmentTests(ITestOutputHelper output) => this.Output = output; private ITestOutputHelper Output { get; } @@ -27,21 +25,24 @@ public class TestEnvironmentTests } [Fact] - public void SolutionDirectoryFullPath() - => this.CheckPath(TestEnvironment.SolutionDirectoryFullPath); + public void SolutionDirectoryFullPath() => + this.CheckPath(TestEnvironment.SolutionDirectoryFullPath); [Fact] - public void InputImagesDirectoryFullPath() - => this.CheckPath(TestEnvironment.InputImagesDirectoryFullPath); + public void InputImagesDirectoryFullPath() => + this.CheckPath(TestEnvironment.InputImagesDirectoryFullPath); [Fact] - public void ExpectedOutputDirectoryFullPath() - => this.CheckPath(TestEnvironment.ReferenceOutputDirectoryFullPath); + public void ExpectedOutputDirectoryFullPath() => + this.CheckPath(TestEnvironment.ReferenceOutputDirectoryFullPath); [Fact] public void GetReferenceOutputFileName() { - string actual = Path.Combine(TestEnvironment.ActualOutputDirectoryFullPath, @"foo\bar\lol.jpeg"); + string actual = Path.Combine( + TestEnvironment.ActualOutputDirectoryFullPath, + @"foo\bar\lol.jpeg" + ); string expected = TestEnvironment.GetReferenceOutputFileName(actual); this.Output.WriteLine(expected); @@ -54,7 +55,10 @@ public class TestEnvironmentTests [InlineData("lol/Baz.JPG", typeof(JpegEncoder))] [InlineData("lol/Baz.gif", typeof(GifEncoder))] [InlineData("lol/foobar.webp", typeof(WebpEncoder))] - public void GetReferenceEncoder_ReturnsCorrectEncoders_Windows(string fileName, Type expectedEncoderType) + public void GetReferenceEncoder_ReturnsCorrectEncoders_Windows( + string fileName, + Type expectedEncoderType + ) { if (!TestEnvironment.IsWindows) { @@ -71,7 +75,10 @@ public class TestEnvironmentTests [InlineData("lol/Baz.JPG", typeof(JpegDecoder))] [InlineData("lol/Baz.gif", typeof(GifDecoder))] [InlineData("lol/foobar.webp", typeof(WebpDecoder))] - public void GetReferenceDecoder_ReturnsCorrectDecoders_Windows(string fileName, Type expectedDecoderType) + public void GetReferenceDecoder_ReturnsCorrectDecoders_Windows( + string fileName, + Type expectedDecoderType + ) { if (!TestEnvironment.IsWindows) { @@ -88,7 +95,10 @@ public class TestEnvironmentTests [InlineData("lol/Baz.JPG", typeof(JpegEncoder))] [InlineData("lol/Baz.gif", typeof(GifEncoder))] [InlineData("lol/foobar.webp", typeof(WebpEncoder))] - public void GetReferenceEncoder_ReturnsCorrectEncoders_Linux(string fileName, Type expectedEncoderType) + public void GetReferenceEncoder_ReturnsCorrectEncoders_Linux( + string fileName, + Type expectedEncoderType + ) { if (!TestEnvironment.IsLinux) { @@ -105,7 +115,10 @@ public class TestEnvironmentTests [InlineData("lol/Baz.JPG", typeof(JpegDecoder))] [InlineData("lol/Baz.gif", typeof(GifDecoder))] [InlineData("lol/foobar.webp", typeof(WebpDecoder))] - public void GetReferenceDecoder_ReturnsCorrectDecoders_Linux(string fileName, Type expectedDecoderType) + public void GetReferenceDecoder_ReturnsCorrectDecoders_Linux( + string fileName, + Type expectedDecoderType + ) { if (!TestEnvironment.IsLinux) { @@ -118,9 +131,13 @@ public class TestEnvironmentTests // RemoteExecutor does not work with "dotnet xunit" used to run tests on 32 bit .NET Framework: // https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30 - public static bool IsNot32BitNetFramework = !TestEnvironment.IsFramework || TestEnvironment.Is64BitProcess; + public static bool IsNot32BitNetFramework => + !TestEnvironment.IsFramework || TestEnvironment.Is64BitProcess; - [Fact(Skip = "Not supported on 32-bit .NET Framework", SkipUnless = nameof(IsNot32BitNetFramework))] + [Fact( + Skip = "Not supported on 32-bit .NET Framework", + SkipUnless = nameof(IsNot32BitNetFramework) + )] public void RemoteExecutor_FailingRemoteTestShouldFailLocalTest() { static void FailingCode() @@ -128,6 +145,8 @@ public class TestEnvironmentTests Assert.False(true); } - Assert.ThrowsAny(() => RemoteExecutor.Invoke(FailingCode).Dispose()); + Assert.ThrowsAny(() => + RemoteExecutor.Invoke(FailingCode).Dispose() + ); } }