Skip to content

emanuelecaurio/Xunit.SkippableFact_ForcePass

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xunit.SkippableFact_ForcePass

GitHub Actions status NuGet package

Same ReadMe of Xunit.SkippableFact.

The project difference regards that skipped test will be successful instead of being ignored.

This project allows for Xunit tests that can determine during execution that they should report a "skipped" result. This can be useful when a precondition is not satisfied, or the test is over functionality that does not exist on the platform being tested.

This package targets Xunit v2. Xunit v3 has skipping built-in. See our Xunit v3 migration doc.

Installation

This project is available as a NuGet package

Usage

Learn more at our documentation site.

Below is a sampling of uses.

Skip based on a runtime check:

[SkippableFactFP]
public void SomeMoodyTest()
{
    Skip_ForcePass.IfNot(InTheMood);
}

Skip based on a thrown exception:

[SkippableFactFP(typeof(NotSupportedException))]
public void TestFunctionalityWhichIsNotSupportedOnSomePlatforms()
{
    // Test functionality. If it throws any of the exceptions listed in the attribute,
    // a skip result is reported instead of a failure.
}

Skip based on SupportedOSPlatformAttribute:

[SkippableFactFP, SupportedOSPlatform("Windows")]
public void TestCngKey()
{
    var key = CngKey.Create(CngAlgorithm.Rsa);
    Assert.NotNull(key);
}

Sponsorships

GitHub Sponsors Zcash

About

Adds Xunit dynamic skipping of facts and theories, forcing tests to succeed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 62.0%
  • C# 36.2%
  • Other 1.8%