From f337f8cd04459e541431df04d859b705f3d2f6f7 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 8 Apr 2015 14:27:38 -0700 Subject: [PATCH] Add TestServer.CreateBuilder overload --- src/Microsoft.AspNet.TestHost/TestServer.cs | 10 ++++++++-- .../Microsoft.AspNet.TestHost.Tests/TestClientTests.cs | 4 ---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNet.TestHost/TestServer.cs b/src/Microsoft.AspNet.TestHost/TestServer.cs index 0e3a9927b5..f290092609 100644 --- a/src/Microsoft.AspNet.TestHost/TestServer.cs +++ b/src/Microsoft.AspNet.TestHost/TestServer.cs @@ -105,16 +105,22 @@ namespace Microsoft.AspNet.TestHost }); } - public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config, Action configureApp, ConfigureServicesDelegate configureServices) + public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config) { return new TestServerBuilder { FallbackServices = fallbackServices, - Startup = new StartupMethods(configureApp, configureServices), Config = config }; } + public static TestServerBuilder CreateBuilder(IServiceProvider fallbackServices, IConfiguration config, Action configureApp, ConfigureServicesDelegate configureServices) + { + var builder = CreateBuilder(fallbackServices, config); + builder.Startup = new StartupMethods(configureApp, configureServices); + return builder; + } + public HttpMessageHandler CreateHandler() { var pathBase = BaseAddress == null ? PathString.Empty : PathString.FromUriComponent(BaseAddress); diff --git a/test/Microsoft.AspNet.TestHost.Tests/TestClientTests.cs b/test/Microsoft.AspNet.TestHost.Tests/TestClientTests.cs index 19b54c06f5..c710d01da1 100644 --- a/test/Microsoft.AspNet.TestHost.Tests/TestClientTests.cs +++ b/test/Microsoft.AspNet.TestHost.Tests/TestClientTests.cs @@ -1,21 +1,17 @@ // 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. -using System; using System.IO; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; -using Microsoft.Framework.DependencyInjection; using Xunit; namespace Microsoft.AspNet.TestHost { public class TestClientTests { - private readonly IServiceProvider _services; private readonly TestServer _server; public TestClientTests()