src/packages/EmbedIO.Testing/TestHttpClient.cs
/// <summary>
/// Creates a test client that communicates with the specified server.
/// </summary>
/// <param name="server">The server.</param>
/// <returns>A newly-created <see cref="TestHttpClient"/>.</returns>
/// <exception cref="ArgumentNullException"><paramref name="server"/> is <see langword="null"/>.</exception>
/// <seealso cref="Create(string)"/>
/// <seealso cref="Create(Uri)"/>
Creates a test client that communicates with the specified server.
Creates a test client that communicates with the specified server .
public static TestHttpClient Create(ITestWebServer server)
        {
            Validate.NotNull(nameof(server), server);
#pragma warning disable CA2000 
            var handler = new TestMessageHandler(server);
#pragma warning restore CA2000
            try
            {
                return new TestHttpClient(handler, server.BaseUrl);
            }
            catch
            {
                handler.Dispose();
                throw;
            }
        }
public static TestHttpClient Create ( ITestWebServer server ) { Validate . NotNull ( nameof ( server ) , server ) ; pragma warning disable CA2000 var handler = new TestMessageHandler ( server ) ; pragma warning restore CA2000 try { return new TestHttpClient ( handler , server . BaseUrl ) ; } catch { handler . Dispose ( ) ; throw ; } }
Creates a test client that communicates with the specified server.
Creates a test client that communicates with the specified server .
// Dispose handler before it goes out of scope - Ownership of handler is transferred to the TestHttpClient instance.
A newly-created .
A newly - created .
None
server
ITestWebServer
None
seealso
None
seealso
None