Test for categoryName passed to ILoggerFactory.CreateLogger() in KestrelServer.ctor() (#797)
This commit is contained in:
parent
08d7f66108
commit
b6a177ef0b
|
|
@ -2,14 +2,14 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Hosting.Server;
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
|
||||||
using Microsoft.AspNetCore.Server.Kestrel;
|
using Microsoft.AspNetCore.Server.Kestrel;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure;
|
using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Internal;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.KestrelTests
|
namespace Microsoft.AspNetCore.Server.KestrelTests
|
||||||
|
|
@ -75,6 +75,14 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
|
||||||
Assert.Equal(1, testLogger.CriticalErrorsLogged);
|
Assert.Equal(1, testLogger.CriticalErrorsLogged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void LoggerCategoryNameIsKestrelServerNamespace()
|
||||||
|
{
|
||||||
|
var mockLoggerFactory = new Mock<ILoggerFactory>();
|
||||||
|
new KestrelServer(Options.Create<KestrelServerOptions>(null), new LifetimeNotImplemented(), mockLoggerFactory.Object);
|
||||||
|
mockLoggerFactory.Verify(factory => factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel"));
|
||||||
|
}
|
||||||
|
|
||||||
private static KestrelServer CreateServer(KestrelServerOptions options, ILogger testLogger)
|
private static KestrelServer CreateServer(KestrelServerOptions options, ILogger testLogger)
|
||||||
{
|
{
|
||||||
var lifetime = new LifetimeNotImplemented();
|
var lifetime = new LifetimeNotImplemented();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue