From 207550176cbb424d11dc929b99d383ff7942c6c0 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 13 Nov 2011 10:16:31 -0800 Subject: [PATCH] Removed assembly level fixtures --- NzbDrone.App.Test/CentralDispatchTests.cs | 3 ++- NzbDrone.App.Test/Fixtures.cs | 8 -------- NzbDrone.App.Test/MonitoringProviderTest.cs | 10 +++------- NzbDrone.App.Test/NzbDrone.App.Test.csproj | 1 - NzbDrone.App.Test/RouterTest.cs | 3 ++- NzbDrone.Common.Test/DiskProviderTests.cs | 3 ++- NzbDrone.Common.Test/EnviromentProviderTest.cs | 3 ++- NzbDrone.Common.Test/Fixtures.cs | 8 -------- NzbDrone.Common.Test/NzbDrone.Common.Test.csproj | 1 - NzbDrone.Common.Test/PathExtentionFixture.cs | 3 ++- NzbDrone.Common.Test/ProcessProviderTests.cs | 3 ++- NzbDrone.Common.Test/ServiceControllerTests.cs | 5 +++-- NzbDrone.Common.Test/WebClientTests.cs | 3 ++- NzbDrone.Common/LogConfiguration.cs | 4 ++++ NzbDrone.Common/ServiceProvider.cs | 8 ++++---- NzbDrone.Core.Test/CentralDispatchFixture.cs | 2 +- NzbDrone.Core/CentralDispatch.cs | 1 + NzbDrone.Core/Instrumentation/LogConfiguration.cs | 7 ++++++- NzbDrone.Update.Test/Fixtures.cs | 8 -------- NzbDrone.Update.Test/NzbDrone.Update.Test.csproj | 2 +- NzbDrone.Update.Test/UpdateProviderStartTest.cs | 5 ++++- NzbDrone.Update.Test/UpdateProviderVerifyTest.cs | 3 ++- 22 files changed, 43 insertions(+), 51 deletions(-) delete mode 100644 NzbDrone.App.Test/Fixtures.cs delete mode 100644 NzbDrone.Common.Test/Fixtures.cs delete mode 100644 NzbDrone.Update.Test/Fixtures.cs diff --git a/NzbDrone.App.Test/CentralDispatchTests.cs b/NzbDrone.App.Test/CentralDispatchTests.cs index 7cf1d74db..5b7ccd1c0 100644 --- a/NzbDrone.App.Test/CentralDispatchTests.cs +++ b/NzbDrone.App.Test/CentralDispatchTests.cs @@ -1,11 +1,12 @@ using FluentAssertions; using NUnit.Framework; using Ninject; +using NzbDrone.Test.Common; namespace NzbDrone.App.Test { [TestFixture] - public class CentralDispatchTests + public class CentralDispatchTests : TestBase { [Test] public void Kernel_can_get_kernel() diff --git a/NzbDrone.App.Test/Fixtures.cs b/NzbDrone.App.Test/Fixtures.cs deleted file mode 100644 index 4089933e0..000000000 --- a/NzbDrone.App.Test/Fixtures.cs +++ /dev/null @@ -1,8 +0,0 @@ -// ReSharper disable CheckNamespace -using NUnit.Framework; -using NzbDrone.Test.Common; - -[SetUpFixture] -public class Fixtures : LoggingTest -{ -} diff --git a/NzbDrone.App.Test/MonitoringProviderTest.cs b/NzbDrone.App.Test/MonitoringProviderTest.cs index 7b3bd0807..2fa024b7a 100644 --- a/NzbDrone.App.Test/MonitoringProviderTest.cs +++ b/NzbDrone.App.Test/MonitoringProviderTest.cs @@ -1,22 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; +using System.Diagnostics; using System.Linq; -using System.Text; using AutoMoq; using FizzWare.NBuilder; -using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Common.Model; -using NzbDrone.Model; using NzbDrone.Providers; +using NzbDrone.Test.Common; namespace NzbDrone.App.Test { [TestFixture] - public class MonitoringProviderTest + public class MonitoringProviderTest : TestBase { [Test] diff --git a/NzbDrone.App.Test/NzbDrone.App.Test.csproj b/NzbDrone.App.Test/NzbDrone.App.Test.csproj index 543832cf4..7fe0e878b 100644 --- a/NzbDrone.App.Test/NzbDrone.App.Test.csproj +++ b/NzbDrone.App.Test/NzbDrone.App.Test.csproj @@ -65,7 +65,6 @@ - diff --git a/NzbDrone.App.Test/RouterTest.cs b/NzbDrone.App.Test/RouterTest.cs index f528e9494..a15d34ab0 100644 --- a/NzbDrone.App.Test/RouterTest.cs +++ b/NzbDrone.App.Test/RouterTest.cs @@ -5,11 +5,12 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Model; +using NzbDrone.Test.Common; namespace NzbDrone.App.Test { [TestFixture] - public class RouterTest + public class RouterTest : TestBase { [TestCase(null, ApplicationMode.Console)] diff --git a/NzbDrone.Common.Test/DiskProviderTests.cs b/NzbDrone.Common.Test/DiskProviderTests.cs index 20f0d59ac..8729ae4b4 100644 --- a/NzbDrone.Common.Test/DiskProviderTests.cs +++ b/NzbDrone.Common.Test/DiskProviderTests.cs @@ -4,11 +4,12 @@ using System.IO; using System.Linq; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - public class DiskProviderTests + public class DiskProviderTests : TestBase { DirectoryInfo BinFolder; DirectoryInfo BinFolderCopy; diff --git a/NzbDrone.Common.Test/EnviromentProviderTest.cs b/NzbDrone.Common.Test/EnviromentProviderTest.cs index 9032ab740..d5157062d 100644 --- a/NzbDrone.Common.Test/EnviromentProviderTest.cs +++ b/NzbDrone.Common.Test/EnviromentProviderTest.cs @@ -4,11 +4,12 @@ using System; using System.IO; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - public class EnviromentProviderTest + public class EnviromentProviderTest : TestBase { readonly EnviromentProvider enviromentProvider = new EnviromentProvider(); diff --git a/NzbDrone.Common.Test/Fixtures.cs b/NzbDrone.Common.Test/Fixtures.cs deleted file mode 100644 index 4089933e0..000000000 --- a/NzbDrone.Common.Test/Fixtures.cs +++ /dev/null @@ -1,8 +0,0 @@ -// ReSharper disable CheckNamespace -using NUnit.Framework; -using NzbDrone.Test.Common; - -[SetUpFixture] -public class Fixtures : LoggingTest -{ -} diff --git a/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj index 705d95e02..d979c397e 100644 --- a/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj +++ b/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj @@ -65,7 +65,6 @@ - diff --git a/NzbDrone.Common.Test/PathExtentionFixture.cs b/NzbDrone.Common.Test/PathExtentionFixture.cs index 96c6342de..7a7905d96 100644 --- a/NzbDrone.Common.Test/PathExtentionFixture.cs +++ b/NzbDrone.Common.Test/PathExtentionFixture.cs @@ -2,11 +2,12 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; +using NzbDrone.Test.Common; namespace NzbDrone.App.Test { [TestFixture] - public class PathExtentionFixture + public class PathExtentionFixture : TestBase { private EnviromentProvider GetEnviromentProvider() diff --git a/NzbDrone.Common.Test/ProcessProviderTests.cs b/NzbDrone.Common.Test/ProcessProviderTests.cs index a30cb00a0..9144eb7fc 100644 --- a/NzbDrone.Common.Test/ProcessProviderTests.cs +++ b/NzbDrone.Common.Test/ProcessProviderTests.cs @@ -3,11 +3,12 @@ using System.Diagnostics; using System.Linq; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - public class ProcessProviderTests + public class ProcessProviderTests : TestBase { private const string DummyProccessName = "NzbDrone.Test.Dummy"; ProcessProvider _processProvider; diff --git a/NzbDrone.Common.Test/ServiceControllerTests.cs b/NzbDrone.Common.Test/ServiceControllerTests.cs index 20e64fa61..9e3999bc0 100644 --- a/NzbDrone.Common.Test/ServiceControllerTests.cs +++ b/NzbDrone.Common.Test/ServiceControllerTests.cs @@ -3,11 +3,12 @@ using System.ServiceProcess; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - public class ServiceControllerTests + public class ServiceControllerTests:TestBase { private const string ALWAYS_INSTALLED_SERVICE = "SCardSvr"; //Smart Card private const string TEMP_SERVICE_NAME = "NzbDrone_Nunit"; //Smart Card @@ -74,7 +75,7 @@ namespace NzbDrone.Common.Test } [Test] - [Timeout(10000)] + //[Timeout(10000)] public void Should_be_able_to_start_and_stop_service() { serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status diff --git a/NzbDrone.Common.Test/WebClientTests.cs b/NzbDrone.Common.Test/WebClientTests.cs index 64613a730..f515ef941 100644 --- a/NzbDrone.Common.Test/WebClientTests.cs +++ b/NzbDrone.Common.Test/WebClientTests.cs @@ -1,11 +1,12 @@ // ReSharper disable InconsistentNaming using FluentAssertions; using NUnit.Framework; +using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - public class WebClientTests + public class WebClientTests : TestBase { [Test] public void DownloadString_should_be_able_to_download_jquery() diff --git a/NzbDrone.Common/LogConfiguration.cs b/NzbDrone.Common/LogConfiguration.cs index 99dbb48c4..f23929611 100644 --- a/NzbDrone.Common/LogConfiguration.cs +++ b/NzbDrone.Common/LogConfiguration.cs @@ -86,8 +86,12 @@ namespace NzbDrone.Common public static void Reload() { + var sw = Stopwatch.StartNew(); LogManager.Configuration.Reload(); LogManager.ReconfigExistingLoggers(); + sw.Stop(); + + Console.WriteLine("Reload: " + sw.Elapsed.TotalSeconds); } } } diff --git a/NzbDrone.Common/ServiceProvider.cs b/NzbDrone.Common/ServiceProvider.cs index c086af759..97ff3c507 100644 --- a/NzbDrone.Common/ServiceProvider.cs +++ b/NzbDrone.Common/ServiceProvider.cs @@ -116,16 +116,16 @@ namespace NzbDrone.Common public virtual void Start(string serviceName) { - Logger.Info("Starting {0} Service..."); + Logger.Info("Starting {0} Service...", serviceName); var service = GetService(serviceName); if (service == null) { Logger.Warn("Unable to start '{0}' no service with that name exists.", serviceName); } - if (service.Status != ServiceControllerStatus.Paused || service.Status != ServiceControllerStatus.Stopped) + if (service.Status != ServiceControllerStatus.Paused && service.Status != ServiceControllerStatus.Stopped) { - Logger.Warn("Service is in a state that can't be started {0}", service.Status); + Logger.Warn("Service is in a state that can't be started. Current status: {0}", service.Status); } service.Start(); @@ -135,7 +135,7 @@ namespace NzbDrone.Common if (service.Status == ServiceControllerStatus.Running) { - Logger.Info("{0} has started successfully."); + Logger.Info("{0} has started successfully.", serviceName); } else { diff --git a/NzbDrone.Core.Test/CentralDispatchFixture.cs b/NzbDrone.Core.Test/CentralDispatchFixture.cs index 9f1cec65c..93d523d1a 100644 --- a/NzbDrone.Core.Test/CentralDispatchFixture.cs +++ b/NzbDrone.Core.Test/CentralDispatchFixture.cs @@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test public void TearDownBase() { WebTimer.Stop(); - + } } } diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 0d313883b..b07df60be 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -39,6 +39,7 @@ namespace NzbDrone.Core MigrationsHelper.Run(mainConnectionString, true); LogConfiguration.RegisterDatabaseLogger(Kernel.Get()); + LogConfiguration.Reload(); Kernel.Get().SetupDefaultProfiles(); Kernel.Get().SetupDefault(); diff --git a/NzbDrone.Core/Instrumentation/LogConfiguration.cs b/NzbDrone.Core/Instrumentation/LogConfiguration.cs index 60ecfec45..23be92ec5 100644 --- a/NzbDrone.Core/Instrumentation/LogConfiguration.cs +++ b/NzbDrone.Core/Instrumentation/LogConfiguration.cs @@ -31,13 +31,18 @@ namespace NzbDrone.Core.Instrumentation Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch"); LogManager.ConfigurationReloaded += ((s, e) => RegisterDatabaseLogger(_databaseTarget)); - Common.LogConfiguration.Reload(); + } public static void RegisterDatabaseLogger(DatabaseTarget databaseTarget) { LogManager.Configuration.AddTarget("DbLogger", databaseTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, databaseTarget)); + Reload(); + } + + public static void Reload() + { Common.LogConfiguration.Reload(); } } diff --git a/NzbDrone.Update.Test/Fixtures.cs b/NzbDrone.Update.Test/Fixtures.cs deleted file mode 100644 index 4089933e0..000000000 --- a/NzbDrone.Update.Test/Fixtures.cs +++ /dev/null @@ -1,8 +0,0 @@ -// ReSharper disable CheckNamespace -using NUnit.Framework; -using NzbDrone.Test.Common; - -[SetUpFixture] -public class Fixtures : LoggingTest -{ -} diff --git a/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj b/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj index ed8e742aa..9e69c58c2 100644 --- a/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj +++ b/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj @@ -48,6 +48,7 @@ ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll + ..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll @@ -66,7 +67,6 @@ - diff --git a/NzbDrone.Update.Test/UpdateProviderStartTest.cs b/NzbDrone.Update.Test/UpdateProviderStartTest.cs index 21d693558..36805695b 100644 --- a/NzbDrone.Update.Test/UpdateProviderStartTest.cs +++ b/NzbDrone.Update.Test/UpdateProviderStartTest.cs @@ -5,12 +5,13 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Common.Model; +using NzbDrone.Test.Common; using NzbDrone.Update.Providers; namespace NzbDrone.Update.Test { [TestFixture] - class UpdateProviderStartTest + class UpdateProviderStartTest : TestBase { AutoMoqer mocker = new AutoMoqer(); @@ -109,6 +110,8 @@ namespace NzbDrone.Update.Test mocker.Resolve().Start(TARGET_FOLDER); + ExceptionVerification.ExcpectedFatals(1); + mocker.VerifyAllMocks(); } diff --git a/NzbDrone.Update.Test/UpdateProviderVerifyTest.cs b/NzbDrone.Update.Test/UpdateProviderVerifyTest.cs index 593ef0e2b..0ac07b5ca 100644 --- a/NzbDrone.Update.Test/UpdateProviderVerifyTest.cs +++ b/NzbDrone.Update.Test/UpdateProviderVerifyTest.cs @@ -6,12 +6,13 @@ using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; +using NzbDrone.Test.Common; using NzbDrone.Update.Providers; namespace NzbDrone.Update.Test { [TestFixture] - class UpdateProviderVerifyTest + class UpdateProviderVerifyTest : TestBase { AutoMoqer mocker = new AutoMoqer();