From 1511d34c0cf0a32bede35da0ba0e5169ad6fef84 Mon Sep 17 00:00:00 2001 From: Vlada Shubina Date: Tue, 24 Jan 2023 23:37:01 +0100 Subject: [PATCH 1/2] added common extended `Fact` and `Theory` attributes to `Microsoft.DotNet.XUnitExtensions` --- ....DotNet.Build.Tasks.Workloads.Tests.csproj | 1 + .../TestHelper.cs | 30 ---------------- .../Microsoft.DotNet.NuGetRepack.Tests.csproj | 1 + .../tests/TestHelpers/SkipIfNotWindows.cs | 16 --------- .../src/Attributes/DotNetOnlyFactAttribute.cs | 27 +++++++++++++++ .../Attributes/DotNetOnlyTheoryAttribute.cs | 27 +++++++++++++++ .../src/Attributes/LinuxOnlyFactAttribute.cs | 28 +++++++++++++++ .../Attributes/LinuxOnlyTheoryAttribute.cs | 28 +++++++++++++++ .../src/Attributes/OsxOnlyFactAttribute.cs | 28 +++++++++++++++ .../src/Attributes/OsxOnlyTheoryAttribute.cs | 28 +++++++++++++++ .../src/Attributes/UnixOnlyFactAttribute.cs | 28 +++++++++++++++ .../src/Attributes/UnixOnlyTheoryAttribute.cs | 28 +++++++++++++++ .../WindowsFullFrameworkOnlyFactAttribute.cs | 33 ++++++++++++++++++ ...WindowsFullFrameworkOnlyTheoryAttribute.cs | 34 +++++++++++++++++++ .../Attributes/WindowsOnlyFactAttribute.cs | 28 +++++++++++++++ .../Attributes/WindowsOnlyTheoryAttribute.cs | 28 +++++++++++++++ .../src/DiscovererHelpers.cs | 5 ++- 17 files changed, 351 insertions(+), 47 deletions(-) delete mode 100644 src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestHelper.cs delete mode 100644 src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/SkipIfNotWindows.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyTheoryAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyTheoryAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyTheoryAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyTheoryAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyFactAttribute.cs create mode 100644 src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyTheoryAttribute.cs diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj index 2c520b0afa5..8e479dbb3ed 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj +++ b/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Microsoft.DotNet.Build.Tasks.Workloads.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestHelper.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestHelper.cs deleted file mode 100644 index 680d88b0469..00000000000 --- a/src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestHelper.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using Xunit; - -namespace Microsoft.DotNet.Build.Tasks.Workloads.Tests -{ - public class WindowsOnlyFactAttribute : FactAttribute - { - public WindowsOnlyFactAttribute() - { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - { - Skip = "Not running on Windows"; - } - } - } - - public class WindowsOnlyTheoryAttribute : TheoryAttribute - { - public WindowsOnlyTheoryAttribute() - { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - { - Skip = "Not running on Windows"; - } - } - } -} diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj b/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj index a7aff11e5b4..f94f3d3fd63 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj +++ b/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj @@ -82,6 +82,7 @@ + diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/SkipIfNotWindows.cs b/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/SkipIfNotWindows.cs deleted file mode 100644 index e1f0201871e..00000000000 --- a/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/SkipIfNotWindows.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Xunit; - -namespace Microsoft.DotNet.Tools.Tests.Utilities -{ - public class WindowsOnlyFactAttribute : FactAttribute - { - public WindowsOnlyFactAttribute() - { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - { - Skip = "Not running on Windows"; - } - } - } -} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyFactAttribute.cs new file mode 100644 index 00000000000..090a638c815 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyFactAttribute.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on .NET (.NET Core). + /// + public class DotNetOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public DotNetOnlyFactAttribute(string? additionalMessage = null) + { + if (!DiscovererHelpers.IsRunningOnNetCoreApp) + { + this.Skip = "This test only runs on .NET.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..33d15d509c7 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/DotNetOnlyTheoryAttribute.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on .NET (.NET Core). + /// + public class DotNetOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public DotNetOnlyTheoryAttribute(string? additionalMessage = null) + { + if (!DiscovererHelpers.IsRunningOnNetCoreApp) + { + this.Skip = "This test only runs on .NET.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyFactAttribute.cs new file mode 100644 index 00000000000..bb1747e4058 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyFactAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Linux. + /// + public class LinuxOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public LinuxOnlyFactAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + this.Skip = "This test requires Linux to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..337dee60007 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/LinuxOnlyTheoryAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Windows. + /// + public class LinuxOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public LinuxOnlyTheoryAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + this.Skip = "This test requires Linux to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs new file mode 100644 index 00000000000..f8fcf1b2dce --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on OSX. + /// + public class OsxOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public OsxOnlyFactAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + this.Skip = "This test requires OSX to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..36e1b6df5ba --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on OSX. + /// + public class OsxOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public OsxOnlyTheoryAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + this.Skip = "This test requires OSX to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyFactAttribute.cs new file mode 100644 index 00000000000..d70dd1ed0bd --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyFactAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Unix (Linux, OSX platforms). + /// + public class UnixOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public UnixOnlyFactAttribute(string? additionalMessage = null) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test requires Unix to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..f816b35b426 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/UnixOnlyTheoryAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Unix (Linux, OSX platforms). + /// + public class UnixOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public UnixOnlyTheoryAttribute(string? additionalMessage = null) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test requires Unix to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyFactAttribute.cs new file mode 100644 index 00000000000..70dbe3ebaab --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyFactAttribute.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Windows on .NET Framework. + /// + public class WindowsFullFrameworkOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public WindowsFullFrameworkOnlyFactAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test only runs on Windows on .NET Framework.".AppendAdditionalMessage(additionalMessage); + return; + } + if (!DiscovererHelpers.IsRunningOnNetFramework) + { + this.Skip = "This test only runs on .NET Framework.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..a36faa7a3ab --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsFullFrameworkOnlyTheoryAttribute.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Windows on full .NET Framework. + /// + public class WindowsFullFrameworkOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// Creates the attribute. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public WindowsFullFrameworkOnlyTheoryAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test only runs on Windows on full framework.".AppendAdditionalMessage(additionalMessage); + return; + } + if (!DiscovererHelpers.IsRunningOnNetFramework) + { + this.Skip = "This test only runs on full framework.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyFactAttribute.cs new file mode 100644 index 00000000000..7da3fcae2bd --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyFactAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Windows. + /// + public class WindowsOnlyFactAttribute : FactAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public WindowsOnlyFactAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test requires Windows to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyTheoryAttribute.cs new file mode 100644 index 00000000000..5d05da5adb3 --- /dev/null +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/WindowsOnlyTheoryAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable + +using System.Runtime.InteropServices; +using Microsoft.DotNet.XUnitExtensions; + +namespace Xunit +{ + /// + /// This test should be run only on Windows. + /// + public class WindowsOnlyTheoryAttribute : TheoryAttribute + { + /// + /// Initializes a new instance of the class. + /// + /// The additional message that is appended to skip reason, when test is skipped. + public WindowsOnlyTheoryAttribute(string? additionalMessage = null) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + this.Skip = "This test requires Windows to run.".AppendAdditionalMessage(additionalMessage); + } + } + } +} diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/DiscovererHelpers.cs b/src/Microsoft.DotNet.XUnitExtensions/src/DiscovererHelpers.cs index 883a5279805..b19046f2240 100644 --- a/src/Microsoft.DotNet.XUnitExtensions/src/DiscovererHelpers.cs +++ b/src/Microsoft.DotNet.XUnitExtensions/src/DiscovererHelpers.cs @@ -108,6 +108,9 @@ internal static IEnumerable> EvaluateArguments(IEnu { yield return new KeyValuePair(XunitConstants.Category, category); } - } + } + + internal static string AppendAdditionalMessage(this string message, string additionalMessage) + => !string.IsNullOrWhiteSpace(additionalMessage) ? $"{message} {additionalMessage}" : message; } } From 601f789fffc16cf1c6b69ddade06e7906f295563 Mon Sep 17 00:00:00 2001 From: Vlada Shubina Date: Wed, 1 Feb 2023 11:13:22 +0100 Subject: [PATCH 2/2] renamed OSX -> macOS --- ...sxOnlyTheoryAttribute.cs => MacOSOnlyFactAttribute.cs} | 8 ++++---- ...sxOnlyFactAttribute.cs => MacOSOnlyTheoryAttribute.cs} | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) rename src/Microsoft.DotNet.XUnitExtensions/src/Attributes/{OsxOnlyTheoryAttribute.cs => MacOSOnlyFactAttribute.cs} (67%) rename src/Microsoft.DotNet.XUnitExtensions/src/Attributes/{OsxOnlyFactAttribute.cs => MacOSOnlyTheoryAttribute.cs} (65%) diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyFactAttribute.cs similarity index 67% rename from src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs rename to src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyFactAttribute.cs index 36e1b6df5ba..0eeda7c5249 100644 --- a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyTheoryAttribute.cs +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyFactAttribute.cs @@ -11,17 +11,17 @@ namespace Xunit /// /// This test should be run only on OSX. /// - public class OsxOnlyTheoryAttribute : TheoryAttribute + public class MacOSOnlyFactAttribute : FactAttribute { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The additional message that is appended to skip reason, when test is skipped. - public OsxOnlyTheoryAttribute(string? additionalMessage = null) + public MacOSOnlyFactAttribute(string? additionalMessage = null) { if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - this.Skip = "This test requires OSX to run.".AppendAdditionalMessage(additionalMessage); + this.Skip = "This test requires macOS to run.".AppendAdditionalMessage(additionalMessage); } } } diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyTheoryAttribute.cs similarity index 65% rename from src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs rename to src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyTheoryAttribute.cs index f8fcf1b2dce..a5489e49e74 100644 --- a/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/OsxOnlyFactAttribute.cs +++ b/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/MacOSOnlyTheoryAttribute.cs @@ -11,17 +11,17 @@ namespace Xunit /// /// This test should be run only on OSX. /// - public class OsxOnlyFactAttribute : FactAttribute + public class MacOSOnlyTheoryAttribute : TheoryAttribute { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The additional message that is appended to skip reason, when test is skipped. - public OsxOnlyFactAttribute(string? additionalMessage = null) + public MacOSOnlyTheoryAttribute(string? additionalMessage = null) { if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - this.Skip = "This test requires OSX to run.".AppendAdditionalMessage(additionalMessage); + this.Skip = "This test requires macOS to run.".AppendAdditionalMessage(additionalMessage); } } }