Add logging to functional tests
This commit is contained in:
parent
11cd669ce4
commit
9e89f798c6
|
|
@ -13,22 +13,23 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
|
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.StaticFiles
|
namespace Microsoft.AspNetCore.StaticFiles
|
||||||
{
|
{
|
||||||
public class StaticFileMiddlewareTests
|
public class StaticFileMiddlewareTests : LoggedTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReturnsNotFoundWithoutWwwroot()
|
public async Task ReturnsNotFoundWithoutWwwroot()
|
||||||
{
|
{
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
|
.ConfigureServices(services => services.AddSingleton(LoggerFactory))
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.Configure(app => app.UseStaticFiles());
|
.Configure(app => app.UseStaticFiles());
|
||||||
|
|
||||||
|
|
@ -47,6 +48,7 @@ namespace Microsoft.AspNetCore.StaticFiles
|
||||||
public async Task FoundFile_LastModifiedTrimsSeconds()
|
public async Task FoundFile_LastModifiedTrimsSeconds()
|
||||||
{
|
{
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
|
.ConfigureServices(services => services.AddSingleton(LoggerFactory))
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseWebRoot(AppContext.BaseDirectory)
|
.UseWebRoot(AppContext.BaseDirectory)
|
||||||
.Configure(app => app.UseStaticFiles());
|
.Configure(app => app.UseStaticFiles());
|
||||||
|
|
@ -87,6 +89,7 @@ namespace Microsoft.AspNetCore.StaticFiles
|
||||||
private async Task FoundFile_Served(string baseUrl, string baseDir, string requestUrl)
|
private async Task FoundFile_Served(string baseUrl, string baseDir, string requestUrl)
|
||||||
{
|
{
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
|
.ConfigureServices(services => services.AddSingleton(LoggerFactory))
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir))
|
.UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir))
|
||||||
.Configure(app => app.UseStaticFiles(new StaticFileOptions()
|
.Configure(app => app.UseStaticFiles(new StaticFileOptions()
|
||||||
|
|
@ -124,6 +127,7 @@ namespace Microsoft.AspNetCore.StaticFiles
|
||||||
public async Task HeadFile_HeadersButNotBodyServed(string baseUrl, string baseDir, string requestUrl)
|
public async Task HeadFile_HeadersButNotBodyServed(string baseUrl, string baseDir, string requestUrl)
|
||||||
{
|
{
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
|
.ConfigureServices(services => services.AddSingleton(LoggerFactory))
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir))
|
.UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir))
|
||||||
.Configure(app => app.UseStaticFiles(new StaticFileOptions()
|
.Configure(app => app.UseStaticFiles(new StaticFileOptions()
|
||||||
|
|
@ -181,6 +185,7 @@ namespace Microsoft.AspNetCore.StaticFiles
|
||||||
var responseComplete = new ManualResetEvent(false);
|
var responseComplete = new ManualResetEvent(false);
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
|
.ConfigureServices(services => services.AddSingleton(LoggerFactory))
|
||||||
.UseWebRoot(Path.Combine(AppContext.BaseDirectory))
|
.UseWebRoot(Path.Combine(AppContext.BaseDirectory))
|
||||||
.Configure(app =>
|
.Configure(app =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue