Created
August 18, 2020 23:21
-
-
Save bradwilson/476c398dc7f187904fa0d5c7bd2447bf to your computer and use it in GitHub Desktop.
Skip attribute: enable or no?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleTests | |
{ | |
public bool SomeCondition => ...; | |
[Fact] | |
public void MySkipWhen() | |
{ | |
Assert.SkipWhen(SomeCondition, "This is dynamically skipped when SomeCondition is true"); | |
} | |
[Fact] | |
public void MySkipUnless() | |
{ | |
Assert.SkipUnless(SomeCondition, "This is dynamically skipped when SomeCondition is false"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleTests | |
{ | |
public bool SomeCondition => ...; | |
[Fact( | |
Skip = "This is dynamically skipped when SomeCondition is true", | |
SkipWhen = nameof(SomeCondition) | |
)] | |
public void MySkipWhen() { } | |
[Fact( | |
Skip = "This is dynamically skipped when SomeCondition is false", | |
SkipUnless = nameof(SomeCondition) | |
)] | |
public void MySkipUnless() { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment