From 452f3443176c6f917bce3a4a4efdb49f08e04851 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 22 Aug 2024 22:45:00 -0700 Subject: [PATCH] Remove 'Diagnostics' package from tests --- .../ComputeSharp.Tests.DeviceLost.csproj | 1 - .../Extensions/DeviceExtensions.cs | 4 ++-- .../ComputeSharp.Tests.DisableDynamicCompilation.csproj | 1 - .../ComputeSharp.Tests.Internals.csproj | 1 - tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj | 1 - tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs | 4 ++-- tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs | 5 ++--- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj index b937f272..cdcd3a9c 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj +++ b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj @@ -11,7 +11,6 @@ - diff --git a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs index d3910436..9847e6f5 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs @@ -1,5 +1,5 @@ +using System; using System.Linq; -using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Extensions; @@ -21,7 +21,7 @@ public static class DeviceExtensions { Device.Discrete => GraphicsDevice.QueryDevices(info => info.IsHardwareAccelerated).FirstOrDefault(), Device.Warp => GraphicsDevice.QueryDevices(info => !info.IsHardwareAccelerated).FirstOrDefault(), - _ => ThrowHelper.ThrowArgumentException("Invalid device.") + _ => throw new ArgumentException("Invalid device type.", nameof(type)) }; if (device is null) diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index 8203cdb7..2a5f9d8c 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -6,7 +6,6 @@ - diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 5ba2fef8..1ec91b4e 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -6,7 +6,6 @@ - diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 1b136057..fb7fe66d 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -11,7 +11,6 @@ - diff --git a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs index 111bf9e8..58b4c630 100644 --- a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs @@ -1,5 +1,5 @@ +using System; using System.Linq; -using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Extensions; @@ -40,7 +40,7 @@ public static class DeviceExtensions { Device.Discrete => DiscreteDevice, Device.Warp => WarpDevice, - _ => ThrowHelper.ThrowArgumentException("Invalid device.") + _ => throw new ArgumentException("Invalid device type.", nameof(type)) }; if (device is null) diff --git a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs index 1c1e75c3..854e69dd 100644 --- a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Runtime.InteropServices; -using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; @@ -24,7 +23,7 @@ public static class ImagingExtensions where TFrom : unmanaged where TTo : unmanaged, IPixel { - Guard.IsEqualTo(sizeof(TTo), sizeof(TFrom), nameof(TTo)); + ArgumentOutOfRangeException.ThrowIfNotEqual(sizeof(TTo), sizeof(TFrom), nameof(TTo)); Image image = new(texture.Width, texture.Height); @@ -49,7 +48,7 @@ public static class ImagingExtensions where TFrom : unmanaged where TTo : unmanaged, IPixel { - Guard.IsEqualTo(sizeof(TTo), sizeof(TFrom), nameof(TTo)); + ArgumentOutOfRangeException.ThrowIfNotEqual(sizeof(TTo), sizeof(TFrom), nameof(TTo)); Image image = new(texture.Width, texture.Height);