Skip to content

Instantly share code, notes, and snippets.

@moodmosaic
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save moodmosaic/2789ba06980880217df7 to your computer and use it in GitHub Desktop.

Select an option

Save moodmosaic/2789ba06980880217df7 to your computer and use it in GitHub Desktop.
F# port of @ploeh's answer at http://stackoverflow.com/a/20723447/467754 for ASP.NET Web API 2.
// F# port of @ploeh's answer at http://stackoverflow.com/a/20723447/467754 for ASP.NET Web API 2.
type WebApiCustomization() =
interface ICustomization with
member this.Customize fixture =
fixture.Customize<HttpConfiguration>(fun c ->
c.OmitAutoProperties() :> ISpecimenBuilder)
fixture.Customize<HttpRequestMessage>(fun c ->
c.Do(fun (x : HttpRequestMessage) ->
x.Properties.[HttpPropertyKeys.HttpConfigurationKey] <-
fixture.Create<HttpConfiguration>())
:> ISpecimenBuilder)
fixture.Customize<HttpRequestContext>(fun c ->
c.Without(fun x -> x.ClientCertificate) :> ISpecimenBuilder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment