Meziantou.Xunit 2.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Meziantou.Xunit --version 2.0.1
                    
NuGet\Install-Package Meziantou.Xunit -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Xunit" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Xunit" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Xunit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Xunit --version 2.0.1
                    
#r "nuget: Meziantou.Xunit, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Xunit@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Xunit&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Xunit&version=2.0.1
                    
Install as a Cake Tool

Meziantou.Xunit

Meziantou.Xunit provides xUnit.v3 attributes to run or skip tests depending on the current environment.

Installation

dotnet add package Meziantou.Xunit

Usage

using Meziantou.Xunit;
using Xunit;

public sealed class SampleTests
{
    [Fact]
    [RunIf(TestOperatingSystems.Windows | TestOperatingSystems.Linux)]
    public void Runs_on_windows_or_linux()
    {
    }

    [Fact]
    [RunIf(globalizationMode: TestGlobalizationMode.NotInvariant)]
    public void Runs_only_when_invariant_globalization_is_disabled()
    {
    }

    [Fact]
    [SkipIf(WindowsGroups.Administrator)]
    public void Skipped_when_running_as_administrator()
    {
    }

    [Fact]
    [RunIf(ContinuousIntegration = ContinuousIntegrationEnvironments.GitHubActions)]
    public void Runs_only_on_github_actions()
    {
    }
}

RunIf executes the test only when all specified conditions match. SkipIf skips the test when all specified conditions match.

Both attributes can be applied to a test method and to its test class, but only once per target. An attribute that specifies no condition has no effect.

Conditions are evaluated once the test class instance has been created. Class fixtures, the test class constructor and IAsyncLifetime.InitializeAsync therefore run even when the test ends up being skipped.

Supported conditions

Condition Type Values
OperatingSystem TestOperatingSystems Windows, Linux, MacOS (Flags)
GlobalizationMode TestGlobalizationMode Any, Invariant, NotInvariant
ContinuousIntegration ContinuousIntegrationEnvironments GitHubActions
WindowsGroup WindowsGroups Any, User, Administrator

GlobalizationMode reflects invariant globalization mode, which is enabled by the InvariantGlobalization MSBuild property or the DOTNET_SYSTEM_GLOBALIZATION_INVARIANT environment variable. Invariant means culture data is not available; NotInvariant means it is.

WindowsGroups.User means the current user is a member of the built-in Users group and is not elevated as an administrator. Any value other than Any also requires Windows.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.5 169 10/24/2026
2.0.4 107 10/21/2026
2.0.3 118 9/30/2026
2.0.2 126 8/29/2026
2.0.1 127 8/23/2026
2.0.0 142 7/5/2026
1.0.2 142 6/13/2026
1.0.1 143 5/14/2026
1.0.0 147 5/11/2026