Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Routing] Move to GenericHost #24281

Merged
merged 5 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. 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.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Xunit;

namespace Microsoft.AspNetCore.Routing.FunctionalTests
{
public class EndpointRoutingBenchmarkTest : IDisposable
{
private readonly HttpClient _client;
private readonly IHost _host;
private readonly TestServer _testServer;

public EndpointRoutingBenchmarkTest()
{
// This switch and value are set by benchmark server when running the app for profiling.
var args = new[] { "--scenarios", "PlaintextEndpointRouting" };
var webHostBuilder = Benchmarks.Program.GetWebHostBuilder(args);
var hostBuilder = Benchmarks.Program.GetHostBuilder(args);

_host = hostBuilder.Build();

// Make sure we are using the right startup
var startupName = webHostBuilder.GetSetting("Startup");
Assert.Equal(nameof(Benchmarks.StartupUsingEndpointRouting), startupName);
var configuration = _host.Services.GetService<IConfiguration>();
var startupName = configuration["Startup"];
Assert.Equal(nameof(Benchmarks.StartupUsingEndpointRouting), startupName);

_testServer = new TestServer(webHostBuilder);
_testServer = _host.GetTestServer();
_host.Start();
_client = _testServer.CreateClient();
_client.BaseAddress = new Uri("http://localhost");
}
Expand Down Expand Up @@ -53,6 +61,7 @@ public void Dispose()
{
_testServer.Dispose();
_client.Dispose();
_host.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. 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.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Xunit;

namespace Microsoft.AspNetCore.Routing.FunctionalTests
{
public class RouterBenchmarkTest : IDisposable
{
private readonly HttpClient _client;
private readonly IHost _host;
private readonly TestServer _testServer;

public RouterBenchmarkTest()
{
// This switch and value are set by benchmark server when running the app for profiling.
var args = new[] { "--scenarios", "PlaintextRouting" };
var webHostBuilder = Benchmarks.Program.GetWebHostBuilder(args);
var hostBuilder = Benchmarks.Program.GetHostBuilder(args);

_host = hostBuilder.Build();

// Make sure we are using the right startup
var startupName = webHostBuilder.GetSetting("Startup");
var configuration = _host.Services.GetService<IConfiguration>();
var startupName = configuration["Startup"];
Assert.Equal(nameof(Benchmarks.StartupUsingRouter), startupName);

_testServer = new TestServer(webHostBuilder);
_testServer = _host.GetTestServer();
_host.Start();
_client = _testServer.CreateClient();
_client.BaseAddress = new Uri("http://localhost");
}
Expand Down Expand Up @@ -53,6 +62,7 @@ public void Dispose()
{
_testServer.Dispose();
_client.Dispose();
_host.Dispose();
}
}
}
}
Loading