From 23a30f3771803fa19a9279ddc19877cc98050ef8 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Tue, 16 Dec 2014 23:26:19 -0800 Subject: [PATCH] fixed logging tests --- .../Download/CompletedDownloadServiceFixture.cs | 2 +- src/NzbDrone.Test.Common/LoggingTest.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs index 324e11ac7..8c35576b8 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.Download Mocker.GetMock() .Setup(c => c.GetDownloadClients()) - .Returns( new IDownloadClient[] { Mocker.GetMock().Object }); + .Returns( new[] { Mocker.GetMock().Object }); Mocker.GetMock() .SetupGet(c => c.Definition) diff --git a/src/NzbDrone.Test.Common/LoggingTest.cs b/src/NzbDrone.Test.Common/LoggingTest.cs index bec3ba054..5e4acab88 100644 --- a/src/NzbDrone.Test.Common/LoggingTest.cs +++ b/src/NzbDrone.Test.Common/LoggingTest.cs @@ -1,20 +1,23 @@ +using System.Linq; using NLog; using NLog.Config; using NLog.Targets; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.Extensions; +using NzbDrone.Common.Instrumentation; namespace NzbDrone.Test.Common { public abstract class LoggingTest { - protected static readonly Logger TestLogger = LogManager.GetLogger("TestLogger"); + protected static readonly Logger TestLogger = NzbDroneLogger.GetLogger("TestLogger"); protected static void InitLogging() { new StartupContext(); - if (LogManager.Configuration == null || LogManager.Configuration is XmlLoggingConfiguration) + if (LogManager.Configuration == null || LogManager.Configuration.AllTargets.None(c => c is ExceptionVerification)) { LogManager.Configuration = new LoggingConfiguration(); var consoleTarget = new ConsoleTarget { Layout = "${level}: ${message} ${exception}" }; @@ -22,6 +25,8 @@ namespace NzbDrone.Test.Common LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget)); RegisterExceptionVerification(); + + LogManager.ReconfigExistingLoggers(); } }