Table of Contents
  v2 v3 AOT   Error

xUnit1055

"Conditional skipping cannot set both SkipUnless and SkipWhen"

Cause

A violation of this rule occurs when the user sets both the SkipUnless and SkipWhen properties for conditional skipping.

Reason for rule

It is only legal to set one or the other property; it is not legal to set both properties.

How to fix violations

To fix a violation of this rule, remove on the declarations.

Examples

Violates

using Xunit;

public class xUnit1055
{
    public static bool AlwaysTrue => true;

    [Fact(Skip = "Don't run", SkipWhen = nameof(AlwaysTrue), SkipUnless = nameof(AlwaysTrue))]
    public void Fact()
    { }
}

Does not violate

using Xunit;

public class xUnit1055
{
    public static bool AlwaysTrue => true;

    [Fact(Skip = "Don't run", SkipWhen = nameof(AlwaysTrue))]
    public void Fact()
    { }
}