Skip to content

Commit

Permalink
Touch-ups on README
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott authored Nov 30, 2024
1 parent 2295987 commit 0dd9ae7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void TestFunctionalityWhichIsNotSupportedOnSomePlatforms()
}
```

### The [SupportedOSPlatform] attribute
## The `[SupportedOSPlatform]` attribute

Since version 1.5, `Xunit.SkippableFact` understands the `SupportedOSPlatform` attribute to skip tests on unsupported platforms.

Expand All @@ -51,10 +51,10 @@ public void TestCngKey()
}
```

Without `[SupportedOSPlatform("Windows")` the [CA1416](CA1416) code analysis warning would trigger:
Without `[SupportedOSPlatform("Windows")]` the [CA1416][CA1416] code analysis warning would trigger:
> This call site is reachable on all platforms. 'CngKey. Create(CngAlgorithm)' is only supported on: 'windows'.
Adding `[SupportedOSPlatform("Windows")` both suppresses this platform compatibility warning and skips the test when running on Linux or macOS.
Adding `[SupportedOSPlatform("Windows")]` both suppresses this platform compatibility warning and skips the test when running on Linux or macOS.

[NuPkg]: https://www.nuget.org/packages/Xunit.SkippableFact
[CA1416]: https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca1416
[CA1416]: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416
2 changes: 1 addition & 1 deletion src/Xunit.SkippableFact/Sdk/TestMethodExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class TestMethodExtensions
/// </summary>
/// <param name="testMethod">The <see cref="ITestMethod"/>.</param>
/// <returns>A description of the supported platforms if the test can not run on the current platform or <see langword="null"/> if the test can run on the current platform.</returns>
public static string? GetPlatformSkipReason(this ITestMethod testMethod)
internal static string? GetPlatformSkipReason(this ITestMethod testMethod)
{
#if NET462
return null;
Expand Down

0 comments on commit 0dd9ae7

Please sign in to comment.