Skip to content

Instantly share code, notes, and snippets.

@mhinze
Created June 20, 2013 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhinze/5822682 to your computer and use it in GitHub Desktop.
Save mhinze/5822682 to your computer and use it in GitHub Desktop.
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