Skip to content

Instantly share code, notes, and snippets.

View madstt's full-sized avatar

Mads Tjørnelund Toustrup madstt

View GitHub Profile
@moodmosaic
moodmosaic / GreedyFactoryMethods.cs
Last active January 2, 2016 17:29
AutoFixture strategy for invoking Factory Methods with most parameters based on Twitter discussion on https://twitter.com/madstt/status/420850414641090560
internal class GreedyFactoryMethodQuery : IMethodQuery
{
public IEnumerable<IMethod> SelectMethods(Type type)
{
if (type == null)
throw new ArgumentNullException("type");
return from mi in type.GetMethods(
BindingFlags.Static | BindingFlags.Public)
where mi.ReturnType == type