Created
October 5, 2013 21:47
-
-
Save plioi/6846456 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Linq; | |
using Fixie; | |
using Fixie.Conventions; | |
public class CustomConvention : Convention | |
{ | |
readonly Ploeh.AutoFixture.Fixture autoFixture = new Ploeh.AutoFixture.Fixture(); | |
public CustomConvention() | |
{ | |
Classes | |
.NameEndsWith("Tests"); | |
Methods | |
.Where(method => method.IsVoid()); | |
Parameters(type => autoFixture.Create(type)); | |
} | |
private void Parameters(Func<Type, object> parameterByType) | |
{ | |
Parameters(method => | |
{ | |
var parameterTypes = method.GetParameters().Select(x => x.ParameterType); | |
var parameterValues = parameterTypes.Select(parameterByType).ToArray(); | |
return new[] { parameterValues }; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment