Created
June 20, 2013 13:29
-
-
Save mhinze/5822682 to your computer and use it in GitHub Desktop.
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
public class CustomConvention : Convention | |
{ | |
public CustomConvention() | |
{ | |
Cases.Where(StartsWith("should", "it")); | |
FixtureExecution.CreateInstancePerFixture(); | |
InstanceExecution.SetUpTearDown(StartsWithWhen(), StartsWithAfter()); | |
} | |
static MethodFilter StartsWithWhen() | |
{ | |
return new MethodFilter().Where(StartsWith("when")); | |
} | |
static MethodFilter StartsWithAfter() | |
{ | |
return new MethodFilter().Where(StartsWith("after")); | |
} | |
static Func<MethodInfo, bool> StartsWith(params string[] prefixes) | |
{ | |
return method => prefixes.Any(s => method.Name.StartsWith(s, StringComparison.OrdinalIgnoreCase)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment