From 42c17e885c6b59275127f942b526e326183ae8a4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 17 Oct 2014 22:47:00 -0700 Subject: [PATCH] Fixed some more tests --- .../NzbDrone.Common.Test.csproj | 1 + .../ServiceFactoryFixture.cs | 10 +++--- .../Instrumentation/DatabaseTarget.cs | 3 -- .../NzbDrone.Mono.Test.csproj | 1 - src/NzbDrone.Mono/DiskProvider.cs | 3 ++ .../NzbDrone.Windows.Test.csproj | 1 - .../ServiceFactoryFixture.cs | 31 ------------------- 7 files changed, 9 insertions(+), 41 deletions(-) rename src/{NzbDrone.Mono.Test => NzbDrone.Common.Test}/ServiceFactoryFixture.cs (73%) delete mode 100644 src/NzbDrone.Windows.Test/ServiceFactoryFixture.cs diff --git a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj index 0f00051e7..f2e2d3429 100644 --- a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj +++ b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj @@ -84,6 +84,7 @@ + diff --git a/src/NzbDrone.Mono.Test/ServiceFactoryFixture.cs b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs similarity index 73% rename from src/NzbDrone.Mono.Test/ServiceFactoryFixture.cs rename to src/NzbDrone.Common.Test/ServiceFactoryFixture.cs index 811edfc66..aad41fca2 100644 --- a/src/NzbDrone.Mono.Test/ServiceFactoryFixture.cs +++ b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs @@ -1,14 +1,13 @@ using System.Linq; using FluentAssertions; using NUnit.Framework; -using NzbDrone.Common; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Messaging.Events; using NzbDrone.Host; using NzbDrone.Test.Common; -namespace NzbDrone.Mono.Test +namespace NzbDrone.Common.Test { [TestFixture] public class ServiceFactoryFixture : TestBase @@ -16,9 +15,10 @@ namespace NzbDrone.Mono.Test [Test] public void event_handlers_should_be_unique() { - MonoOnly(); - - Mocker.SetConstant(MainAppContainerBuilder.BuildContainer(new StartupContext())); + var container = MainAppContainerBuilder.BuildContainer(new StartupContext()); + container.Resolve().Register(); + + Mocker.SetConstant(container); var handlers = Subject.BuildAll>() .Select(c => c.GetType().FullName); diff --git a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs index daf308f96..244396565 100644 --- a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs +++ b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs @@ -4,7 +4,6 @@ using System.Data.SQLite; using NLog.Common; using NLog.Config; using NLog; -using NLog.Layouts; using NLog.Targets; using NzbDrone.Common.Instrumentation; using NzbDrone.Core.Datastore; @@ -78,12 +77,10 @@ namespace NzbDrone.Core.Instrumentation log.Message += ": " + logEvent.Exception.Message; } - log.Exception = logEvent.Exception.ToString(); log.ExceptionType = logEvent.Exception.GetType().ToString(); } - log.Level = logEvent.Level.Name; var sqlCommand = new SQLiteCommand(INSERT_COMMAND, _connection); diff --git a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj index 237b47521..2a4622534 100644 --- a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj @@ -74,7 +74,6 @@ - diff --git a/src/NzbDrone.Mono/DiskProvider.cs b/src/NzbDrone.Mono/DiskProvider.cs index 7b9a96342..8be9ad768 100644 --- a/src/NzbDrone.Mono/DiskProvider.cs +++ b/src/NzbDrone.Mono/DiskProvider.cs @@ -55,6 +55,9 @@ namespace NzbDrone.Mono catch (NotImplementedException) { } + catch (PlatformNotSupportedException) + { + } } public override void SetPermissions(string path, string mask, string user, string group) diff --git a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj index 7cd8890a4..da510fac0 100644 --- a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj +++ b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj @@ -71,7 +71,6 @@ - diff --git a/src/NzbDrone.Windows.Test/ServiceFactoryFixture.cs b/src/NzbDrone.Windows.Test/ServiceFactoryFixture.cs deleted file mode 100644 index bde389da2..000000000 --- a/src/NzbDrone.Windows.Test/ServiceFactoryFixture.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Linq; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Common; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.Messaging.Events; -using NzbDrone.Host; -using NzbDrone.Test.Common; - -namespace NzbDrone.Windows.Test -{ - [TestFixture] - public class ServiceFactoryFixture : TestBase - { - [SetUp] - public void setup() - { - Mocker.SetConstant(MainAppContainerBuilder.BuildContainer(new StartupContext())); - } - - [Test] - public void event_handlers_should_be_unique() - { - var handlers = Subject.BuildAll>() - .Select(c => c.GetType().FullName); - - handlers.Should().OnlyHaveUniqueItems(); - } - } -} \ No newline at end of file