From 51518787d8309128922039e246b47ecc6e9caba7 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 13 Nov 2011 16:22:18 -0800 Subject: [PATCH 1/2] Lots of initialization, configuration clean up. --- NzbDrone.App.Test/MonitoringProviderTest.cs | 3 +- NzbDrone.App.Test/RouterTest.cs | 2 +- .../ConfigFileProviderTest.cs | 37 ++++----- NzbDrone.Common.Test/PathExtentionFixture.cs | 8 +- NzbDrone.Common/ConfigFileProvider.cs | 72 +++++++---------- NzbDrone.Common/LogConfiguration.cs | 6 ++ NzbDrone.Common/PathExtentions.cs | 36 +++++---- NzbDrone.Core.Test/CentralDispatchFixture.cs | 2 + NzbDrone.Core.Test/Framework/CoreTest.cs | 10 +++ NzbDrone.Core.Test/IndexerTests.cs | 3 +- .../JobTests/BacklogSearchJobTest.cs | 3 +- .../JobTests/BannerDownloadJobTest.cs | 2 +- .../JobTests/DiskScanJobTest.cs | 3 +- .../JobTests/ImportNewSeriesJobTest.cs | 3 +- NzbDrone.Core.Test/JobTests/SearchJobTest.cs | 3 +- .../JobTests/SeasonSearchJobTest.cs | 3 +- .../JobTests/SeriesSearchJobTest.cs | 3 +- .../ProviderTests/ConfigProviderTest.cs | 3 +- .../DiskProviderTests/FreeDiskSpaceTest.cs | 3 +- .../ProviderTests/DiskScanProviderTest.cs | 3 +- .../DiskScanProviderTest_ImportFile.cs | 3 +- .../ProviderTests/DownloadProviderTest.cs | 3 +- .../ProviderTests/EpisodeProviderTest.cs | 3 +- ...isodeProviderTest_DeleteInvalidEpisodes.cs | 3 +- ...deProviderTest_GetEpisodesByParseResult.cs | 3 +- .../ProviderTests/EventClientProviderTest.cs | 3 +- .../ProviderTests/GrowlProviderTest.cs | 3 +- .../ProviderTests/HistoryProviderTest.cs | 3 +- .../ProviderTests/IndexerProviderTest.cs | 3 +- .../InventoryProvider_IsAcceptableSizeTest.cs | 3 +- .../InventoryProvider_IsMonitoredTest.cs | 3 +- .../InventoryProvider_QualityNeededTest.cs | 3 +- .../JobProviderTests/JobProviderTest.cs | 3 +- .../ProviderTests/LogProviderTest.cs | 5 +- .../ProviderTests/MediaFileProviderTests.cs | 3 +- .../MediaFileProvider_GetNewFilenameTest.cs | 3 +- .../ProviderTests/MisnamedProviderTest.cs | 3 +- .../PostDownloadProviderFixture.cs | 3 +- .../ProcessDownloadFixture.cs | 3 +- .../ProviderTests/ProwlProviderTest.cs | 3 +- .../ProviderTests/QualityTypeProviderTest.cs | 3 +- .../ProviderTests/RootDirProviderTest.cs | 3 +- .../ProviderTests/SabProviderTest.cs | 3 +- .../SearchProviderTest_Episode.cs | 3 +- .../SearchProviderTest_PartialSeason.cs | 3 +- .../SearchProviderTest_Season.cs | 3 +- .../ProviderTests/SeriesProviderTest.cs | 3 +- .../UpcomingEpisodesProviderTest.cs | 3 +- .../GetAvilableUpdateFixture.cs | 3 +- .../PreformUpdateFixture.cs | 77 +++++++++++------- .../ProviderTests/XbmcProviderTest.cs | 3 +- NzbDrone.Core.Test/QualityProfileTest.cs | 3 +- NzbDrone.Core.Test/SceneMappingTest.cs | 3 +- NzbDrone.Core.Test/SortHelperTest.cs | 2 +- NzbDrone.Core.Test/dbBenchmark.cs | 3 +- NzbDrone.Core/CentralDispatch.cs | 79 +++++++++---------- NzbDrone.Core/Datastore/MigrationsHelper.cs | 1 + NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs | 2 +- .../Instrumentation/DatabaseTarget.cs | 10 +++ .../Instrumentation/LogConfiguration.cs | 49 ------------ NzbDrone.Core/NzbDrone.Core.csproj | 1 - NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs | 5 +- .../Unity/AutoMockingBuilderStrategy.cs | 3 +- .../Unity/AutoMockingContainerExtension.cs | 4 +- NzbDrone.Test.Common/TestBase.cs | 6 +- .../UpdateProviderVerifyFixture.cs | 3 +- .../EditorLocalization.designer.cs | 2 +- NzbDrone.Web/Global.asax.cs | 8 ++ NzbDrone.Web/Helpers/IsCurrentActionHelper.cs | 5 +- NzbDrone.Web/NzbDrone.Web.csproj | 4 + NzbDrone.Web/Views/Shared/_Layout.cshtml | 2 +- NzbDrone.Web/log.config | 16 +--- NzbDrone/CentralDispatch.cs | 1 - config.xml | 6 +- 74 files changed, 316 insertions(+), 279 deletions(-) delete mode 100644 NzbDrone.Core/Instrumentation/LogConfiguration.cs diff --git a/NzbDrone.App.Test/MonitoringProviderTest.cs b/NzbDrone.App.Test/MonitoringProviderTest.cs index 2fa024b7a..e7277ed3d 100644 --- a/NzbDrone.App.Test/MonitoringProviderTest.cs +++ b/NzbDrone.App.Test/MonitoringProviderTest.cs @@ -1,6 +1,6 @@ using System.Diagnostics; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -8,6 +8,7 @@ using NzbDrone.Common; using NzbDrone.Common.Model; using NzbDrone.Providers; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.App.Test { diff --git a/NzbDrone.App.Test/RouterTest.cs b/NzbDrone.App.Test/RouterTest.cs index a15d34ab0..5c9e50841 100644 --- a/NzbDrone.App.Test/RouterTest.cs +++ b/NzbDrone.App.Test/RouterTest.cs @@ -1,11 +1,11 @@ using System.ServiceProcess; -using AutoMoq; using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Model; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.App.Test { diff --git a/NzbDrone.Common.Test/ConfigFileProviderTest.cs b/NzbDrone.Common.Test/ConfigFileProviderTest.cs index 2d1f0ff7f..39fe8825e 100644 --- a/NzbDrone.Common.Test/ConfigFileProviderTest.cs +++ b/NzbDrone.Common.Test/ConfigFileProviderTest.cs @@ -1,13 +1,13 @@ -using System.IO; -using AutoMoq; +using System.Linq; +using System.IO; + using FluentAssertions; using NUnit.Framework; -using NzbDrone.Common; using NzbDrone.Common.Model; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; - -namespace NzbDrone.Core.Test.ProviderTests +namespace NzbDrone.Common.Test { [TestFixture] // ReSharper disable InconsistentNaming @@ -23,8 +23,6 @@ namespace NzbDrone.Core.Test.ProviderTests if (File.Exists(configFile)) File.Delete(configFile); - - Mocker.Resolve().CreateDefaultConfigFile(); } [Test] @@ -133,19 +131,6 @@ namespace NzbDrone.Core.Test.ProviderTests result.Should().Be(value); } - [Test] - public void GetValue_New_Key_with_new_parent() - { - const string key = "Hello"; - const string value = "World"; - - //Act - var result = Mocker.Resolve().GetValue(key, value, "Universe"); - - //Assert - result.Should().Be(value); - } - [Test] public void GetAuthenticationType_No_Existing_Value() { @@ -169,5 +154,17 @@ namespace NzbDrone.Core.Test.ProviderTests //Assert result.Should().Be(AuthenticationType.Windows); } + + [Test] + public void Guid_should_return_the_same_every_time() + { + //Act + var firstResponse = Mocker.Resolve().Guid; + var secondResponse = Mocker.Resolve().Guid; + + + //Assert + secondResponse.Should().Be(firstResponse); + } } } \ No newline at end of file diff --git a/NzbDrone.Common.Test/PathExtentionFixture.cs b/NzbDrone.Common.Test/PathExtentionFixture.cs index 7a7905d96..c1d5abb4d 100644 --- a/NzbDrone.Common.Test/PathExtentionFixture.cs +++ b/NzbDrone.Common.Test/PathExtentionFixture.cs @@ -1,10 +1,10 @@ -using FluentAssertions; +using System.Linq; +using FluentAssertions; using Moq; using NUnit.Framework; -using NzbDrone.Common; using NzbDrone.Test.Common; -namespace NzbDrone.App.Test +namespace NzbDrone.Common.Test { [TestFixture] public class PathExtentionFixture : TestBase @@ -16,7 +16,7 @@ namespace NzbDrone.App.Test envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\"); return envMoq.Object; - } + } [Test] diff --git a/NzbDrone.Common/ConfigFileProvider.cs b/NzbDrone.Common/ConfigFileProvider.cs index e3768b1fe..495c57ce6 100644 --- a/NzbDrone.Common/ConfigFileProvider.cs +++ b/NzbDrone.Common/ConfigFileProvider.cs @@ -13,13 +13,27 @@ namespace NzbDrone.Common private readonly EnviromentProvider _enviromentProvider; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - - private readonly string _configFile; public ConfigFileProvider(EnviromentProvider enviromentProvider) { _enviromentProvider = enviromentProvider; _configFile = _enviromentProvider.GetConfigPath(); + + CreateDefaultConfigFile(); + } + + public virtual Guid Guid + { + get + { + var key = "Guid"; + if (string.IsNullOrWhiteSpace(GetValue(key, string.Empty))) + { + SetValue(key, Guid.NewGuid().ToString()); + } + + return Guid.Parse(GetValue(key, string.Empty)); + } } public virtual int Port @@ -40,27 +54,23 @@ namespace NzbDrone.Common set { SetValue("AuthenticationType", (int)value); } } - public virtual string GetValue(string key, object defaultValue, string parent = null) + public virtual int GetValueInt(string key, int defaultValue) + { + return Convert.ToInt32(GetValue(key, defaultValue)); + } + + public virtual bool GetValueBoolean(string key, bool defaultValue) + { + return Convert.ToBoolean(GetValue(key, defaultValue)); + } + + public virtual string GetValue(string key, object defaultValue) { var xDoc = XDocument.Load(_configFile); var config = xDoc.Descendants("Config").Single(); var parentContainer = config; - if (!String.IsNullOrEmpty(parent)) - { - //Add the parent - if (config.Descendants(parent).Count() != 1) - { - SetValue(key, defaultValue, parent); - - //Reload the configFile - xDoc = XDocument.Load(_configFile); - config = xDoc.Descendants("Config").Single(); - } - - parentContainer = config.Descendants(parent).Single(); - } var valueHolder = parentContainer.Descendants(key).ToList(); @@ -68,40 +78,20 @@ namespace NzbDrone.Common return valueHolder.First().Value; //Save the value - SetValue(key, defaultValue, parent); + SetValue(key, defaultValue); //return the default value return defaultValue.ToString(); } - public virtual int GetValueInt(string key, int defaultValue, string parent = null) - { - return Convert.ToInt32(GetValue(key, defaultValue, parent)); - } - public virtual bool GetValueBoolean(string key, bool defaultValue, string parent = null) - { - return Convert.ToBoolean(GetValue(key, defaultValue, parent)); - } - - public virtual void SetValue(string key, object value, string parent = null) + public virtual void SetValue(string key, object value) { var xDoc = XDocument.Load(_configFile); var config = xDoc.Descendants("Config").Single(); var parentContainer = config; - if (!String.IsNullOrEmpty(parent)) - { - //Add the parent container if it doesn't already exist - if (config.Descendants(parent).Count() != 1) - { - config.Add(new XElement(parent)); - } - - parentContainer = config.Descendants(parent).Single(); - } - var keyHolder = parentContainer.Descendants(key); if (keyHolder.Count() != 1) @@ -113,7 +103,7 @@ namespace NzbDrone.Common xDoc.Save(_configFile); } - public virtual void CreateDefaultConfigFile() + private void CreateDefaultConfigFile() { if (!File.Exists(_configFile)) { @@ -125,8 +115,6 @@ namespace NzbDrone.Common } } - - public virtual void UpdateIISConfig(string configPath) { logger.Info(@"Server configuration file: {0}", configPath); diff --git a/NzbDrone.Common/LogConfiguration.cs b/NzbDrone.Common/LogConfiguration.cs index 705c35f5b..7d7ede948 100644 --- a/NzbDrone.Common/LogConfiguration.cs +++ b/NzbDrone.Common/LogConfiguration.cs @@ -33,6 +33,8 @@ namespace NzbDrone.Common consoleTarget.Layout = "${message} ${exception}"; LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule(loggerNamePattern, minLevel, consoleTarget)); + + LogManager.ConfigurationReloaded += (sender, args) => RegisterConsoleLogger(minLevel, loggerNamePattern); } catch (Exception e) { @@ -56,6 +58,8 @@ namespace NzbDrone.Common udpTarget.IncludeNdc = true; LogManager.Configuration.AddTarget(udpTarget.GetType().Name, udpTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, udpTarget)); + + LogManager.ConfigurationReloaded += (sender, args) => RegisterUdpLogger(); } catch (Exception e) { @@ -76,6 +80,8 @@ namespace NzbDrone.Common var exTarget = new ExceptioneerTarget(); LogManager.Configuration.AddTarget("Exceptioneer", exTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Error, exTarget)); + + LogManager.ConfigurationReloaded += (sender, args) => RegisterExceptioneer(); } catch (Exception e) { diff --git a/NzbDrone.Common/PathExtentions.cs b/NzbDrone.Common/PathExtentions.cs index 3e6ff95a2..6a1071097 100644 --- a/NzbDrone.Common/PathExtentions.cs +++ b/NzbDrone.Common/PathExtentions.cs @@ -19,21 +19,7 @@ namespace NzbDrone.Common private const string UPDATE_SANDBOX_FOLDER_NAME = "nzbdrone_update\\"; private const string UPDATE_PACKAGE_FOLDER_NAME = "nzbdrone\\"; private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\"; - - public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider) - { - return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME); - } - - public static string GetUpdateBackUpFolder(this EnviromentProvider enviromentProvider) - { - return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME); - } - - public static string GetUpdatePackageFolder(this EnviromentProvider enviromentProvider) - { - return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME); - } + private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe"; public static string GetIISFolder(this EnviromentProvider enviromentProvider) { @@ -89,5 +75,25 @@ namespace NzbDrone.Common { return Path.Combine(enviromentProvider.GetWebRoot(), "Cache"); } + + public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider) + { + return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME); + } + + public static string GetUpdateBackUpFolder(this EnviromentProvider enviromentProvider) + { + return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_BACKUP_FOLDER_NAME); + } + + public static string GetUpdatePackageFolder(this EnviromentProvider enviromentProvider) + { + return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_PACKAGE_FOLDER_NAME); + } + + public static string GetUpdateClientExePath(this EnviromentProvider enviromentProvider) + { + return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_CLIENT_EXE); + } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/CentralDispatchFixture.cs b/NzbDrone.Core.Test/CentralDispatchFixture.cs index 93d523d1a..77d867e1d 100644 --- a/NzbDrone.Core.Test/CentralDispatchFixture.cs +++ b/NzbDrone.Core.Test/CentralDispatchFixture.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using FluentAssertions; using NLog; using NUnit.Framework; +using NzbDrone.Common; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Jobs; diff --git a/NzbDrone.Core.Test/Framework/CoreTest.cs b/NzbDrone.Core.Test/Framework/CoreTest.cs index 0bf8e1037..877096554 100644 --- a/NzbDrone.Core.Test/Framework/CoreTest.cs +++ b/NzbDrone.Core.Test/Framework/CoreTest.cs @@ -1,6 +1,7 @@ using System.IO; using NUnit.Framework; using Ninject; +using NzbDrone.Common; using NzbDrone.Test.Common; using PetaPoco; @@ -11,6 +12,7 @@ namespace NzbDrone.Core.Test.Framework { static CoreTest() { + //Delete old db files var oldDbFiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories); foreach (var file in oldDbFiles) { @@ -21,6 +23,14 @@ namespace NzbDrone.Core.Test.Framework catch { } } + //Delete App_data folder + var appData = new EnviromentProvider().GetAppDataPath(); + + if (Directory.Exists(appData)) + { + Directory.Delete(appData, true); + } + MockLib.CreateDataBaseTemplate(); } diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index df5d66b31..8d295ac05 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Net; using System.ServiceModel.Syndication; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -17,6 +17,7 @@ using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.ProviderTests; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test { diff --git a/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs index ab29338af..fe33fe733 100644 --- a/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -8,6 +8,7 @@ using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Repository; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/JobTests/BannerDownloadJobTest.cs b/NzbDrone.Core.Test/JobTests/BannerDownloadJobTest.cs index 2e3f0922f..07e98d88d 100644 --- a/NzbDrone.Core.Test/JobTests/BannerDownloadJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/BannerDownloadJobTest.cs @@ -1,6 +1,6 @@ using System.IO; using System.Net; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; diff --git a/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs b/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs index 2ca294f16..78224ad1f 100644 --- a/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs index 1cdaa57a3..d1a435980 100644 --- a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/JobTests/SearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SearchJobTest.cs index 36bdcba25..2e8db2fe4 100644 --- a/NzbDrone.Core.Test/JobTests/SearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SearchJobTest.cs @@ -1,9 +1,10 @@ using System; -using AutoMoq; + using Moq; using NUnit.Framework; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Jobs; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs index fa95e89d8..8c4229ad2 100644 --- a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -9,6 +9,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs index a8a69f91d..72b4ce867 100644 --- a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; -using AutoMoq; + using Moq; using NUnit.Framework; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { diff --git a/NzbDrone.Core.Test/ProviderTests/ConfigProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/ConfigProviderTest.cs index 62bce6cf9..97d1b83cd 100644 --- a/NzbDrone.Core.Test/ProviderTests/ConfigProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/ConfigProviderTest.cs @@ -1,13 +1,14 @@ using System; using System.Linq; using System.Reflection; -using AutoMoq; + using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; using PetaPoco; namespace NzbDrone.Core.Test.ProviderTests diff --git a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs b/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs index e7a27d4a6..520236346 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using AutoMoq; + using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest.cs index b58b59e84..400f37835 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -10,6 +10,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest_ImportFile.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest_ImportFile.cs index a34adfda1..57cf7ad38 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest_ImportFile.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTest_ImportFile.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -13,6 +13,7 @@ using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTest.cs index ce1ac4713..c32448fa2 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTest.cs @@ -1,5 +1,5 @@ using System; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -8,6 +8,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; // ReSharper disable InconsistentNaming diff --git a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs index 7482c3d91..e2dc1e745 100644 --- a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -14,6 +14,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; using PetaPoco; using TvdbLib.Data; diff --git a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs index efc47f1a0..8ff4bf99e 100644 --- a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs +++ b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; using TvdbLib.Data; namespace NzbDrone.Core.Test.ProviderTests diff --git a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs index f2cb6db5c..56d817e44 100644 --- a/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs +++ b/NzbDrone.Core.Test/ProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; @@ -10,6 +10,7 @@ using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs index 6e6bc544e..4b37ffa5b 100644 --- a/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs @@ -1,13 +1,14 @@ // ReSharper disable RedundantUsingDirective using System; -using AutoMoq; + using Moq; using NUnit.Framework; using NzbDrone.Core.Model.Xbmc; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Xbmc; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs index 3c70d4a96..e2c45e60c 100644 --- a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs @@ -1,5 +1,5 @@ using System; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -9,6 +9,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; // ReSharper disable InconsistentNaming diff --git a/NzbDrone.Core.Test/ProviderTests/HistoryProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/HistoryProviderTest.cs index 556559b93..e32d860ba 100644 --- a/NzbDrone.Core.Test/ProviderTests/HistoryProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/HistoryProviderTest.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -9,6 +9,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs index 8df70dd2b..e10cac97e 100644 --- a/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Net; using System.ServiceModel.Syndication; -using AutoMoq; + using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Model; @@ -13,6 +13,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsAcceptableSizeTest.cs b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsAcceptableSizeTest.cs index b25538a03..ab6048a0a 100644 --- a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsAcceptableSizeTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsAcceptableSizeTest.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsMonitoredTest.cs b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsMonitoredTest.cs index c786f106a..2911231c9 100644 --- a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsMonitoredTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_IsMonitoredTest.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_QualityNeededTest.cs b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_QualityNeededTest.cs index 3b538664a..dd3f342de 100644 --- a/NzbDrone.Core.Test/ProviderTests/InventoryProvider_QualityNeededTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/InventoryProvider_QualityNeededTest.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderTest.cs index 6c0ce248c..38c6169f2 100644 --- a/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderTest.cs @@ -4,13 +4,14 @@ using System.Linq; using System; using System.Collections.Generic; using System.Threading; -using AutoMoq; + using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/LogProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/LogProviderTest.cs index 22012c763..fc054dbb1 100644 --- a/NzbDrone.Core.Test/ProviderTests/LogProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/LogProviderTest.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -13,6 +13,7 @@ using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; using PetaPoco; namespace NzbDrone.Core.Test.ProviderTests @@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests public void Setup() { db = MockLib.GetEmptyDatabase(true); - LogConfiguration.RegisterDatabaseLogger(new DatabaseTarget(db)); + new DatabaseTarget(db).Register(); Logger = LogManager.GetCurrentClassLogger(); } diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests.cs index e92fb5dbd..85a49ff17 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests.cs @@ -1,7 +1,7 @@ // ReSharper disable RedundantUsingDirective using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -11,6 +11,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProvider_GetNewFilenameTest.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProvider_GetNewFilenameTest.cs index 2b7609f61..8094ee4e9 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProvider_GetNewFilenameTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProvider_GetNewFilenameTest.cs @@ -1,7 +1,7 @@ // ReSharper disable RedundantUsingDirective using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using NUnit.Framework; using NzbDrone.Core.Providers; @@ -9,6 +9,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs index f90a9e0d1..8fcc180d1 100644 --- a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -7,6 +7,7 @@ using NUnit.Framework; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/PostDownloadProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/PostDownloadProviderFixture.cs index 55861608a..501d56d84 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/PostDownloadProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/PostDownloadProviderFixture.cs @@ -1,5 +1,6 @@ // ReSharper disable RedundantUsingDirective +using System.Linq; using System; using System.IO; using FluentAssertions; @@ -8,7 +9,7 @@ using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Test.Framework; -namespace NzbDrone.Core.Test.ProviderTests +namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests { [TestFixture] // ReSharper disable InconsistentNaming diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs index c9f3b70d6..fbe39a7f1 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using Moq; using NUnit.Framework; @@ -14,6 +14,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs index 2e856935f..cc33d09cc 100644 --- a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs @@ -1,5 +1,5 @@ using System; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -10,6 +10,7 @@ using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; using Prowlin; // ReSharper disable InconsistentNaming diff --git a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs index 4431f3559..54fb097fc 100644 --- a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs @@ -1,13 +1,14 @@ // ReSharper disable RedundantUsingDirective using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/RootDirProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/RootDirProviderTest.cs index 17cf3d018..99569614f 100644 --- a/NzbDrone.Core.Test/ProviderTests/RootDirProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/RootDirProviderTest.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -using AutoMoq; + using FluentAssertions; using Moq; using NUnit.Framework; @@ -11,6 +11,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/SabProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/SabProviderTest.cs index 0618c33a7..4297c63d3 100644 --- a/NzbDrone.Core.Test/ProviderTests/SabProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/SabProviderTest.cs @@ -3,7 +3,7 @@ using System; using System.IO; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -15,6 +15,7 @@ using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Episode.cs b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Episode.cs index e4d1601fe..12d640eeb 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Episode.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Episode.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -14,6 +14,7 @@ using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_PartialSeason.cs b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_PartialSeason.cs index 82d389571..cfb761ca0 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_PartialSeason.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_PartialSeason.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Season.cs b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Season.cs index 5366202f6..f71bc1b99 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Season.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchProviderTest_Season.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -13,6 +13,7 @@ using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs index 5d8042b03..6f7455ec6 100644 --- a/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -10,6 +10,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; // ReSharper disable InconsistentNaming namespace NzbDrone.Core.Test.ProviderTests diff --git a/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs index 311c58ab0..2d8166461 100644 --- a/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs @@ -3,13 +3,14 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/GetAvilableUpdateFixture.cs b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/GetAvilableUpdateFixture.cs index 5e988e858..6ca9d4718 100644 --- a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/GetAvilableUpdateFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/GetAvilableUpdateFixture.cs @@ -1,5 +1,5 @@ using System; -using AutoMoq; + using FluentAssertions; using Moq; using NUnit.Framework; @@ -7,6 +7,7 @@ using NzbDrone.Common; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests { diff --git a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs index 8dfe0e488..fdf863b3c 100644 --- a/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/UpdateProviderTests/PreformUpdateFixture.cs @@ -1,7 +1,10 @@ using System; +using System.Diagnostics; using System.IO; using FluentAssertions; +using Moq; using NUnit.Framework; +using Ninject.Activation.Strategies; using NzbDrone.Common; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; @@ -13,44 +16,68 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests [TestFixture] internal class PreformUpdateFixture : CoreTest { - - private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\"; - [SetUp] - public void setup() + private readonly UpdatePackage updatePackage = new UpdatePackage { - WithStrictMocker(); + FileName = "NzbDrone.kay.one.0.6.0.2031.zip", + Url = "http://update.nzbdrone.com/_test/NzbDrone.zip", + Version = new Version("0.6.0.2031") + }; - + [SetUp] + public void Setup() + { + Mocker.GetMock().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\"); } + + [Test] + public void Should_download_update_package() + { + var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); + + //Act + Mocker.Resolve().StartUpgrade(updatePackage); + + //Assert + Mocker.GetMock().Verify( + c => c.DownloadFile(updatePackage.Url, updateArchive)); + } + [Test] public void Should_call_download_and_extract_using_correct_arguments() { - Mocker.GetMock().SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\"); - - var updatePackage = new UpdatePackage - { - FileName = "NzbDrone.kay.one.0.6.0.2031.zip", - Url = "http://update.nzbdrone.com/kayone/NzbDrone.kay.one.0.6.0.2031.zip", - Version = new Version("0.6.0.2031") - }; - var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); - Mocker.GetMock().Setup( - c => c.DownloadFile(updatePackage.Url, updateArchive)); - - Mocker.GetMock().Setup( - c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER)); - //Act Mocker.Resolve().StartUpgrade(updatePackage); + + //Assert + Mocker.GetMock().Verify( + c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER)); } [Test] + public void should_start_update_client() + { + //Setup + var updateClientPath = Mocker.GetMock().Object.GetUpdateClientExePath(); + + //Act + Mocker.Resolve().StartUpgrade(updatePackage); + + //Assert + Mocker.GetMock().Verify( + c => c.Start(It.Is(p => + p.FileName == updateClientPath && + p.Arguments == "/12 /" + ))); + } + + [Test] + [Category(IntegrationTest)] public void Should_download_and_extract_to_temp_folder() { @@ -58,13 +85,6 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests var updateSubFolder = new DirectoryInfo(Mocker.GetMock().Object.GetUpdateSandboxFolder()); - var updatePackage = new UpdatePackage - { - FileName = "NzbDrone.kay.one.0.6.0.2031.zip", - Url = "http://update.nzbdrone.com/_test/NzbDrone.zip", - Version = new Version("0.6.0.2031") - }; - //Act updateSubFolder.Exists.Should().BeFalse(); @@ -81,6 +101,5 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests updateSubFolder.GetDirectories().Should().HaveCount(1); updateSubFolder.GetFiles().Should().HaveCount(1); } - } } diff --git a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs index cba1bf035..c1c343264 100644 --- a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs @@ -1,7 +1,7 @@ // ReSharper disable RedundantUsingDirective using System; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; @@ -12,6 +12,7 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Xbmc; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { diff --git a/NzbDrone.Core.Test/QualityProfileTest.cs b/NzbDrone.Core.Test/QualityProfileTest.cs index d185e199e..9c60ea126 100644 --- a/NzbDrone.Core.Test/QualityProfileTest.cs +++ b/NzbDrone.Core.Test/QualityProfileTest.cs @@ -1,7 +1,7 @@ // ReSharper disable RedundantUsingDirective using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; @@ -9,6 +9,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test { diff --git a/NzbDrone.Core.Test/SceneMappingTest.cs b/NzbDrone.Core.Test/SceneMappingTest.cs index c703f3480..7f900b4d2 100644 --- a/NzbDrone.Core.Test/SceneMappingTest.cs +++ b/NzbDrone.Core.Test/SceneMappingTest.cs @@ -1,9 +1,10 @@ -using AutoMoq; + using FizzWare.NBuilder; using NUnit.Framework; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test { diff --git a/NzbDrone.Core.Test/SortHelperTest.cs b/NzbDrone.Core.Test/SortHelperTest.cs index 90f11bcce..cdc5eb574 100644 --- a/NzbDrone.Core.Test/SortHelperTest.cs +++ b/NzbDrone.Core.Test/SortHelperTest.cs @@ -1,7 +1,7 @@ // ReSharper disable RedundantUsingDirective using System; using System.Collections.Generic; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using Moq; diff --git a/NzbDrone.Core.Test/dbBenchmark.cs b/NzbDrone.Core.Test/dbBenchmark.cs index ea9033100..d03973280 100644 --- a/NzbDrone.Core.Test/dbBenchmark.cs +++ b/NzbDrone.Core.Test/dbBenchmark.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading; -using AutoMoq; + using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; @@ -10,6 +10,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.AutoMoq; using PetaPoco; namespace NzbDrone.Core.Test diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 1d8e7d0a2..6195b784d 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.IO; using System.Linq; using Ninject; using NLog; @@ -7,68 +8,58 @@ using NzbDrone.Common; using NzbDrone.Core.Datastore; using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Providers; -using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.ExternalNotification; using NzbDrone.Core.Providers.Indexer; using NzbDrone.Core.Providers.Jobs; using PetaPoco; -using LogConfiguration = NzbDrone.Core.Instrumentation.LogConfiguration; namespace NzbDrone.Core { public class CentralDispatch { - private readonly Object KernelLock = new object(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public CentralDispatch() - { - InitializeApp(); - } - public StandardKernel Kernel { get; private set; } - private void InitializeApp() + public CentralDispatch() { - BindKernel(); + Logger.Debug("Initializing Kernel:"); + Kernel = new StandardKernel(); - Kernel.Get().Setup(); + InitDatabase(); - var mainConnectionString = Kernel.Get().MainConnectionString; + InitQuality(); + InitExternalNotifications(); + InitIndexers(); + InitJobs(); + } + + private void InitDatabase() + { + Logger.Info("Initializing Database..."); - MigrationsHelper.Run(mainConnectionString, true); + var appDataPath = new EnviromentProvider().GetAppDataPath(); + if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath); - LogConfiguration.RegisterDatabaseLogger(Kernel.Get()); + var connection = Kernel.Get(); + Kernel.Bind().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope(); + Kernel.Bind().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto().InSingletonScope(); + Kernel.Bind().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto().InSingletonScope(); + + Kernel.Get().Register(); LogConfiguration.Reload(); + } + private void InitQuality() + { + Logger.Info("Initializing Quality..."); Kernel.Get().SetupDefaultProfiles(); Kernel.Get().SetupDefault(); - Kernel.Get().CreateDefaultConfigFile(); - - BindExternalNotifications(); - BindIndexers(); - BindJobs(); } - private void BindKernel() - { - lock (KernelLock) - { - Logger.Debug("Binding Ninject's Kernel"); - Kernel = new StandardKernel(); - - var connection = Kernel.Get(); - - Kernel.Bind().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope(); - Kernel.Bind().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto().InSingletonScope(); - Kernel.Bind().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto().InSingletonScope(); - - Kernel.Bind().ToSelf().InSingletonScope(); - } - } - - private void BindIndexers() + private void InitIndexers() { + Logger.Info("Initializing Indexers..."); Kernel.Bind().To(); Kernel.Bind().To(); Kernel.Bind().To(); @@ -78,8 +69,12 @@ namespace NzbDrone.Core Kernel.Get().InitializeIndexers(indexers.ToList()); } - private void BindJobs() + private void InitJobs() { + Logger.Info("Initializing Background Jobs..."); + + Kernel.Bind().ToSelf().InSingletonScope(); + Kernel.Bind().To().InSingletonScope(); Kernel.Bind().To().InSingletonScope(); Kernel.Bind().To().InSingletonScope(); @@ -101,8 +96,9 @@ namespace NzbDrone.Core Kernel.Get().StartTimer(30); } - private void BindExternalNotifications() + private void InitExternalNotifications() { + Logger.Info("Initializing External Notifications..."); Kernel.Bind().To(); Kernel.Bind().To(); Kernel.Bind().To(); @@ -113,9 +109,6 @@ namespace NzbDrone.Core Kernel.Get().InitializeNotifiers(notifiers.ToList()); } - /// - /// Forces IISExpress process to exit with the host application - /// public void DedicateToHost() { try @@ -143,7 +136,7 @@ namespace NzbDrone.Core private static void ShutDown() { - Logger.Info("Shutting down application."); + Logger.Info("Shutting down application..."); WebTimer.Stop(); Process.GetCurrentProcess().Kill(); } diff --git a/NzbDrone.Core/Datastore/MigrationsHelper.cs b/NzbDrone.Core/Datastore/MigrationsHelper.cs index 0267ce58b..2e1a8196f 100644 --- a/NzbDrone.Core/Datastore/MigrationsHelper.cs +++ b/NzbDrone.Core/Datastore/MigrationsHelper.cs @@ -53,6 +53,7 @@ namespace NzbDrone.Core.Datastore private static void EnsureDatabase(string constr) { var connection = new SqlCeConnection(constr); + if (!File.Exists(connection.Database)) { var engine = new SqlCeEngine(constr); diff --git a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs index e0027035f..95840de21 100644 --- a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs +++ b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs @@ -9,6 +9,7 @@ */ //#define PETAPOCO_NO_DYNAMIC //in your project settings on .NET 3.5 +// ReSharper disable CheckNamespace using System; using System.Collections; @@ -23,7 +24,6 @@ using System.Reflection; using System.Reflection.Emit; using System.Linq.Expressions; - namespace PetaPoco { // Poco's marked [Explicit] require all column properties to be marked diff --git a/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/NzbDrone.Core/Instrumentation/DatabaseTarget.cs index 09a3ff307..41c23ef2f 100644 --- a/NzbDrone.Core/Instrumentation/DatabaseTarget.cs +++ b/NzbDrone.Core/Instrumentation/DatabaseTarget.cs @@ -1,4 +1,5 @@ using System; +using NLog.Config; using Ninject; using NLog; using NLog.Targets; @@ -19,6 +20,15 @@ namespace NzbDrone.Core.Instrumentation _database = database; } + + public void Register() + { + LogManager.Configuration.AddTarget("DbLogger", this); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, this)); + + LogManager.ConfigurationReloaded += (sender, args) => Register(); + LogConfiguration.Reload(); + } protected override void Write(LogEventInfo logEvent) diff --git a/NzbDrone.Core/Instrumentation/LogConfiguration.cs b/NzbDrone.Core/Instrumentation/LogConfiguration.cs deleted file mode 100644 index 23be92ec5..000000000 --- a/NzbDrone.Core/Instrumentation/LogConfiguration.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.IO; -using Ninject; -using NLog; -using NLog.Config; -using NzbDrone.Common; -using NzbDrone.Core.Providers; - -namespace NzbDrone.Core.Instrumentation -{ - public class LogConfiguration - { - private readonly EnviromentProvider _enviromentProvider; - private readonly DatabaseTarget _databaseTarget; - - public LogConfiguration(EnviromentProvider enviromentProvider, DatabaseTarget databaseTarget) - { - _enviromentProvider = enviromentProvider; - _databaseTarget = databaseTarget; - } - - public void Setup() - { - if (Common.EnviromentProvider.IsProduction) - { - LogManager.ThrowExceptions = false; - } - - LogManager.Configuration = new XmlLoggingConfiguration(_enviromentProvider.GetNlogConfigPath(), false); - - Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication"); - Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch"); - - LogManager.ConfigurationReloaded += ((s, e) => RegisterDatabaseLogger(_databaseTarget)); - - } - - 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(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index d63ebccc3..0704a0304 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -288,7 +288,6 @@ - diff --git a/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs index 27b2eee78..552b150a6 100644 --- a/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs +++ b/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs @@ -1,17 +1,18 @@ // ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Runtime.CompilerServices; -using AutoMoq.Unity; using Microsoft.Practices.Unity; using Moq; using Moq.Language.Flow; +using NzbDrone.Test.Common.AutoMoq.Unity; [assembly: InternalsVisibleTo("AutoMoq.Tests")] -namespace AutoMoq +namespace NzbDrone.Test.Common.AutoMoq { public class AutoMoqer { diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs index af393fbee..79f2b422f 100644 --- a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs +++ b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs @@ -1,4 +1,5 @@ // ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; using System.Linq; @@ -7,7 +8,7 @@ using Microsoft.Practices.ObjectBuilder2; using Microsoft.Practices.Unity; using Moq; -namespace AutoMoq.Unity +namespace NzbDrone.Test.Common.AutoMoq.Unity { internal class AutoMockingBuilderStrategy : BuilderStrategy { diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs index d9979df32..91777b155 100644 --- a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs +++ b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs @@ -1,10 +1,12 @@ // ReSharper disable RedundantUsingDirective + +using System.Linq; using System; using System.Collections.Generic; using Microsoft.Practices.Unity; using Microsoft.Practices.Unity.ObjectBuilder; -namespace AutoMoq.Unity +namespace NzbDrone.Test.Common.AutoMoq.Unity { internal class AutoMockingContainerExtension : UnityContainerExtension { diff --git a/NzbDrone.Test.Common/TestBase.cs b/NzbDrone.Test.Common/TestBase.cs index 3c919270a..52049652d 100644 --- a/NzbDrone.Test.Common/TestBase.cs +++ b/NzbDrone.Test.Common/TestBase.cs @@ -1,15 +1,19 @@ using System.Linq; using System.IO; -using AutoMoq; + using Moq; using NUnit.Framework; using NzbDrone.Common; +using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Test.Common { public class TestBase : LoggingTest // ReSharper disable InconsistentNaming { + + protected const string IntegrationTest = "Integration Test"; + protected AutoMoqer Mocker; protected string VirtualPath diff --git a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs index 6ca63d193..ffe62626e 100644 --- a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs +++ b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs @@ -1,12 +1,13 @@ // ReSharper disable InconsistentNaming using System; using System.IO; -using AutoMoq; + using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Update.Providers; namespace NzbDrone.Update.Test diff --git a/NzbDrone.Web/App_GlobalResources/EditorLocalization.designer.cs b/NzbDrone.Web/App_GlobalResources/EditorLocalization.designer.cs index c4c3e9fb9..7a19bf0b8 100644 --- a/NzbDrone.Web/App_GlobalResources/EditorLocalization.designer.cs +++ b/NzbDrone.Web/App_GlobalResources/EditorLocalization.designer.cs @@ -7,7 +7,7 @@ // the code is regenerated. // //------------------------------------------------------------------------------ - +// ReSharper disable CheckNamespace namespace Resources { using System; diff --git a/NzbDrone.Web/Global.asax.cs b/NzbDrone.Web/Global.asax.cs index 690913b65..407d03145 100644 --- a/NzbDrone.Web/Global.asax.cs +++ b/NzbDrone.Web/Global.asax.cs @@ -8,9 +8,11 @@ using System.Web.Caching; using System.Web.Mvc; using System.Web.Routing; using MvcMiniProfiler; +using NLog.Config; using Ninject; using Ninject.Web.Mvc; using NLog; +using NzbDrone.Common; using NzbDrone.Core; using NzbDrone.Core.Instrumentation; using Telerik.Web.Mvc; @@ -54,6 +56,12 @@ namespace NzbDrone.Web protected override IKernel CreateKernel() { + Common.LogConfiguration.RegisterUdpLogger(); + Common.LogConfiguration.RegisterExceptioneer(); + Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication"); + Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch"); + + LogManager.Configuration = new XmlLoggingConfiguration(new EnviromentProvider().GetNlogConfigPath(), false); var dispatch = new CentralDispatch(); Logger.Info("NzbDrone Starting up."); diff --git a/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs b/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs index 0f6b579a0..1681d169f 100644 --- a/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs +++ b/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs @@ -1,8 +1,9 @@ -using System; +using System.Linq; +using System; using System.Web.Mvc; using System.Web.Mvc.Html; -namespace Helpers +namespace NzbDrone.Web.Helpers { public static class IsCurrentActionHelper { diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 1e95ce60d..7962bd742 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -63,6 +63,10 @@ 3.5 + + True + ..\packages\SqlServerCompact.4.0.8482.1\lib\System.Data.SqlServerCe.dll + True diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index 39c53d802..107cdf314 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -1,6 +1,6 @@  -@using Helpers; @using NzbDrone.Common +@using NzbDrone.Web.Helpers diff --git a/NzbDrone.Web/log.config b/NzbDrone.Web/log.config index 4b102fb74..b2132c04f 100644 --- a/NzbDrone.Web/log.config +++ b/NzbDrone.Web/log.config @@ -1,24 +1,10 @@  - - - - - - - - - - - - + \ No newline at end of file diff --git a/NzbDrone/CentralDispatch.cs b/NzbDrone/CentralDispatch.cs index 68c52fb77..3e1f9c60d 100644 --- a/NzbDrone/CentralDispatch.cs +++ b/NzbDrone/CentralDispatch.cs @@ -47,7 +47,6 @@ namespace NzbDrone LogConfiguration.RegisterUdpLogger(); LogConfiguration.RegisterExceptioneer(); LogConfiguration.Reload(); - _kernel.Get().CreateDefaultConfigFile(); Logger.Info("Start-up Path:'{0}'", _kernel.Get().ApplicationPath); } } diff --git a/config.xml b/config.xml index 5d35eea2e..6a1a578ab 100644 --- a/config.xml +++ b/config.xml @@ -1,2 +1,6 @@  - \ No newline at end of file + + 8989 + 0 + true + \ No newline at end of file From 53be0e374b101234cd751ff54ddc943d105bc121 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 13 Nov 2011 16:23:49 -0800 Subject: [PATCH 2/2] Log file is off by default. --- NzbDrone.Web/log.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NzbDrone.Web/log.config b/NzbDrone.Web/log.config index b2132c04f..766a6f1c6 100644 --- a/NzbDrone.Web/log.config +++ b/NzbDrone.Web/log.config @@ -5,6 +5,6 @@ fileName="${basedir}/App_Data/logs/${shortdate}.txt" /> - + \ No newline at end of file