Breakdance_WebApi_HttpConfigurationExtensions

Extension methods for making HttpConfiguration a little more test-friendly.

Syntax

public static class Breakdance_WebApi_HttpConfigurationExtensions

Inheritance

Methods

GetTestableHttpClient

public static HttpClient GetTestableHttpClient(this HttpConfiguration config)
Creates a new HttpServer for a given HttpConfiguration, and returns a new that uses said HttpServer.

Parameters

  • config HttpConfiguration: The HttpConfiguration to use with the internal HttpServer.

Returns

HttpClient An whose configuration is bonded to an HttpServer so developers don’t have to manually configure all of the elements required to successfully test the API.

GetTestableHttpServer

public static HttpServer GetTestableHttpServer(this HttpConfiguration config)
Gets a new HttpServer instance for a given HttpConfiguration, suitable for use in unit tests.

Parameters

  • config HttpConfiguration:

Returns

HttpServer A new HttpServer instance whose InnerHandler allows for automatic HTTP redirects.