dotnet-sdk/test/Dapr.Actors.AspNetCore.Inte.../AppWebApplicationFactory.cs

48 lines
1.4 KiB
C#

// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
namespace Dapr.Actors.AspNetCore.IntegrationTest
{
using Dapr.Actors.AspNetCore.IntegrationTest.App;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
// The customizations here suppress logging from showing up in the console when
// running at the command line.
public class AppWebApplicationFactory : WebApplicationFactory<Startup>
{
protected override IWebHostBuilder CreateWebHostBuilder()
{
var builder = base.CreateWebHostBuilder();
if (builder == null)
{
return null;
}
builder.ConfigureLogging(b =>
{
b.SetMinimumLevel(LogLevel.None);
});
return builder;
}
protected override IHostBuilder CreateHostBuilder()
{
var builder = base.CreateHostBuilder();
if (builder == null)
{
return null;
}
builder.ConfigureLogging(b =>
{
b.SetMinimumLevel(LogLevel.None);
});
return builder;
}
}
}