From b6a177ef0b5ff27ebc1a49e7d1ad24f88a8b129a Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Thu, 25 Aug 2016 11:53:16 -0700 Subject: [PATCH] Test for categoryName passed to ILoggerFactory.CreateLogger() in KestrelServer.ctor() (#797) --- .../KestrelServerTests.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/KestrelServerTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/KestrelServerTests.cs index b93e4a0450..ae4f63828d 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/KestrelServerTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/KestrelServerTests.cs @@ -2,14 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Reflection; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Server.Kestrel; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; -using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Moq; using Xunit; namespace Microsoft.AspNetCore.Server.KestrelTests @@ -75,6 +75,14 @@ namespace Microsoft.AspNetCore.Server.KestrelTests Assert.Equal(1, testLogger.CriticalErrorsLogged); } + [Fact] + public void LoggerCategoryNameIsKestrelServerNamespace() + { + var mockLoggerFactory = new Mock(); + new KestrelServer(Options.Create(null), new LifetimeNotImplemented(), mockLoggerFactory.Object); + mockLoggerFactory.Verify(factory => factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel")); + } + private static KestrelServer CreateServer(KestrelServerOptions options, ILogger testLogger) { var lifetime = new LifetimeNotImplemented();