Last active
August 29, 2015 14:00
-
-
Save deejaygraham/11375398 to your computer and use it in GitHub Desktop.
xUnit test categorisation using traits
This file contains 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
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | |
public class InMemoryTestAttribute : TraitAttribute | |
{ | |
public InMemoryTestAttribute() | |
: base("Category", "Fast") | |
{ | |
} | |
} | |
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | |
public class TouchingFileSystemTestAttribute : TraitAttribute | |
{ | |
public TouchingFileSystemTestAttribute() | |
: base("Category", "Slow - FileSystem") | |
{ | |
} | |
} | |
public class CompilerFacts | |
{ | |
[Fact] | |
[InMemoryTest] | |
public void Compiler_Created_With_Default_Properties() | |
{ | |
// ... fast test here | |
} | |
[Fact] | |
[TouchingFileSystemTest] | |
public void Compiler_Writes_File_In_Correct_Location() | |
{ | |
// ... slow test here | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment