Created
October 5, 2013 21:43
-
-
Save plioi/6846415 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
public static class AutoFixtureExtensions | |
{ | |
//Normal AutoFixture usage is to write: | |
// | |
// var thing = autoFixture.Create<MyClass>(); | |
// | |
//If all you have is an arbitrary Type object, though, | |
//this extension method lets you write: | |
// | |
// var thing = autoFixture.Create(type); | |
public static object Create(this ISpecimenBuilder builder, Type type) | |
{ | |
return new SpecimenContext(builder).Resolve(type); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment