Created
March 22, 2014 07:30
-
-
Save ploeh/9702672 to your computer and use it in GitHub Desktop.
ASP.NET Web API 2 ApiController AutoFixture Customization
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
type ApiControllerCustomization() = | |
let controllerSpecification = | |
{ new IRequestSpecification with | |
member this.IsSatisfiedBy request = | |
match request with | |
| :? Type as t when typeof<ApiController>.IsAssignableFrom t -> | |
true | |
| _ -> false } | |
interface ICustomization with | |
member this.Customize fixture = | |
fixture.Customizations.Add( | |
FilteringSpecimenBuilder( | |
MethodInvoker( | |
ModestConstructorQuery()), | |
controllerSpecification)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only thing this really does is to ensure that all ApiControllers are created by AutoFixture without AutoProperties...