Reacting to new hosting API

This commit is contained in:
John Luo 2016-01-07 11:54:27 -08:00
parent ffd950966e
commit b826491234
5 changed files with 32 additions and 17 deletions

View File

@ -42,11 +42,13 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var applicationBuilder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(ConfigureEchoAddress);
using (var app = applicationBuilder.Build().Start())
using (var app = applicationBuilder.Build())
{
app.Start();
using (var client = new HttpClient())
{
foreach (var testUrl in testUrls)

View File

@ -81,7 +81,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var builder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -94,8 +94,10 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = builder.Build().Start())
using (var app = builder.Build())
{
app.Start();
using (var client = new HttpClient())
{
var response = await client.GetAsync(requestAddress);

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var applicationBuilder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -54,8 +54,10 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = applicationBuilder.Build().Start())
using (var app = applicationBuilder.Build())
{
app.Start();
using (var client = new HttpClient())
{
var bytes = new byte[1024 * 1024];
@ -100,7 +102,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var builder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -110,9 +112,11 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = builder.Build().Start())
using (var app = builder.Build())
using (var client = new HttpClient())
{
app.Start();
client.DefaultRequestHeaders.Connection.Clear();
client.DefaultRequestHeaders.Connection.Add("close");
@ -130,7 +134,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var builder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -147,9 +151,11 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = builder.Build().Start())
using (var app = builder.Build())
using (var client = new HttpClient())
{
app.Start();
var response = await client.GetAsync($"http://{requestAddress}:{port}/");
response.EnsureSuccessStatusCode();

View File

@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var applicationBuilder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -50,8 +50,10 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = applicationBuilder.Build().Start())
using (var app = applicationBuilder.Build())
{
app.Start();
using (var client = new HttpClient())
{
var response = await client.GetAsync("http://localhost:8792/");
@ -88,7 +90,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var hostBuilder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
app.Run(async context =>
@ -99,8 +101,10 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = hostBuilder.Build().Start())
using (var app = hostBuilder.Build())
{
app.Start();
using (var client = new HttpClient())
{
var response = await client.GetAsync("http://localhost:8793/");

View File

@ -7,7 +7,6 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.Extensions.Configuration;
using Xunit;
@ -26,7 +25,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
var applicationBuilder = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseServer("Microsoft.AspNet.Server.Kestrel")
.Configure(app =>
{
var serverInfo = app.ServerFeatures.Get<IKestrelServerInformation>();
@ -37,8 +36,10 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
});
});
using (var app = applicationBuilder.Build().Start())
using (var app = applicationBuilder.Build())
{
app.Start();
using (var client = new HttpClient())
{
// Send 20 requests just to make sure we don't get any failures