-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip
family properties cause error in custom attributes
#3071
Comments
That's not how that's intended to be used. FactAttribute has a settable public class MyAttribute : FactAttribute
{
public MyAttribute()
{
Skip = "My Reason";
SkipUnless = nameof(ShouldRun);
}
public static bool ShouldRun => 1 == 2;
} |
Also, you don't need a custom attribute for this. Instead, you could just do this: public static bool ShouldRun => 1 == 2;
[Fact(Skip = "My Reason", SkipUnless = nameof(ShouldRun))]
public void My_Test_Method()
{
} |
Thanks for the answer. Something strange happens with this code. It seems that xUnit expects to see
|
Sorry, I forgot to mention that if you're putting it in the attribute, you need to use |
If you create a custom
FactAttribute
(or even a simple attribute) and apply it to a test method, using the Skip family properties results in an error in the test runner instead of displaying a warning that the test was skipped.Using
Skip
family properties directly in test methods works as expected.The text was updated successfully, but these errors were encountered: