Add TestServer.CreateBuilder overload

This commit is contained in:
Hao Kung 2015-04-08 14:27:38 -07:00
parent 992f4bab5d
commit f337f8cd04
2 changed files with 8 additions and 6 deletions

View File

@ -105,16 +105,22 @@ namespace Microsoft.AspNet.TestHost
}); });
} }
public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config, Action<IApplicationBuilder> configureApp, ConfigureServicesDelegate configureServices) public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config)
{ {
return new TestServerBuilder return new TestServerBuilder
{ {
FallbackServices = fallbackServices, FallbackServices = fallbackServices,
Startup = new StartupMethods(configureApp, configureServices),
Config = config Config = config
}; };
} }
public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config, Action<IApplicationBuilder> configureApp, ConfigureServicesDelegate configureServices)
{
var builder = CreateBuilder(fallbackServices, config);
builder.Startup = new StartupMethods(configureApp, configureServices);
return builder;
}
public HttpMessageHandler CreateHandler() public HttpMessageHandler CreateHandler()
{ {
var pathBase = BaseAddress == null ? PathString.Empty : PathString.FromUriComponent(BaseAddress); var pathBase = BaseAddress == null ? PathString.Empty : PathString.FromUriComponent(BaseAddress);

View File

@ -1,21 +1,17 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Xunit; using Xunit;
namespace Microsoft.AspNet.TestHost namespace Microsoft.AspNet.TestHost
{ {
public class TestClientTests public class TestClientTests
{ {
private readonly IServiceProvider _services;
private readonly TestServer _server; private readonly TestServer _server;
public TestClientTests() public TestClientTests()