diff --git a/NzbDrone.Update.Test/ProgramFixture.cs b/NzbDrone.Update.Test/ProgramFixture.cs index c42628e6e..0e4080b0e 100644 --- a/NzbDrone.Update.Test/ProgramFixture.cs +++ b/NzbDrone.Update.Test/ProgramFixture.cs @@ -5,38 +5,21 @@ using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Common.Model; using NzbDrone.Test.Common; -using NzbDrone.Update.Providers; +using NzbDrone.Update.UpdateEngine; namespace NzbDrone.Update.Test { [TestFixture] - public class ProgramFixture : TestBase + public class ProgramFixture : TestBase { - private Program _program; - [SetUp] - public void Setup() - { - _program = Mocker.Resolve(); - } [Test] public void should_throw_if_null_passed_in() { - Assert.Throws(() => _program.Start(null)); + Assert.Throws(() => Subject.Start(null)); } - [Test] - public void should_throw_if_less_than_two_arguments_arent_passed_in() - { - Assert.Throws(() => _program.Start(new[] { "" })); - } - - [Test] - public void should_throw_if_more_than_two_arguments_arent_passed_in() - { - Assert.Throws(() => _program.Start(new[] { "", "", "" })); - } [TestCase("d", "")] [TestCase("", "")] @@ -46,7 +29,7 @@ namespace NzbDrone.Update.Test [TestCase(".", "")] public void should_throw_if_first_arg_isnt_an_int(string arg1, string arg2) { - Assert.Throws(() => _program.Start(new[] { arg1, arg2 })); + Assert.Throws(() => Subject.Start(new[] { arg1, arg2 })); } [Test] @@ -57,11 +40,11 @@ namespace NzbDrone.Update.Test Mocker.GetMock().Setup(c => c.GetProcessById(12)) .Returns(new ProcessInfo() { StartPath = ProcessPath }); - - _program.Start(new[] { "12", "" }); - - Mocker.GetMock().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once()); + Subject.Start(new[] { "12", "" }); + + + Mocker.GetMock().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once()); } diff --git a/NzbDrone.Update.Test/UpdateProviderStartFixture.cs b/NzbDrone.Update.Test/UpdateProviderStartFixture.cs index 74c9ddeda..7add7ae1e 100644 --- a/NzbDrone.Update.Test/UpdateProviderStartFixture.cs +++ b/NzbDrone.Update.Test/UpdateProviderStartFixture.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +/* +using System.Collections.Generic; using System.IO; using System.Linq; using FizzWare.NBuilder; @@ -7,7 +8,7 @@ using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Common.Model; using NzbDrone.Test.Common; -using NzbDrone.Update.Providers; +using NzbDrone.Update.UpdateEngine; namespace NzbDrone.Update.Test { @@ -58,7 +59,7 @@ namespace NzbDrone.Update.Test WithServiceRunning(true); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once()); @@ -71,7 +72,7 @@ namespace NzbDrone.Update.Test WithServiceRunning(false); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Never()); @@ -81,7 +82,7 @@ namespace NzbDrone.Update.Test public void should_not_stop_nzbdrone_service_if_service_isnt_installed() { - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock().Verify(c => c.Stop(It.IsAny()), Times.Never()); @@ -97,7 +98,7 @@ namespace NzbDrone.Update.Test .Returns(proccesses); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock().Verify(c => c.KillAll(ProcessProvider.NzbDroneProcessName), Times.Once()); @@ -111,7 +112,7 @@ namespace NzbDrone.Update.Test .Returns(new List()); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock().Verify(c => c.Kill(It.IsAny()), Times.Never()); @@ -123,7 +124,7 @@ namespace NzbDrone.Update.Test Mocker.GetMock() .Setup(c => c.CopyDirectory(TARGET_FOLDER, BACKUP_FOLDER)); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); } [Test] @@ -135,7 +136,7 @@ namespace NzbDrone.Update.Test Mocker.GetMock() .Setup(c => c.DeleteFolder(UPDATE_FOLDER, true)); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); } [Test] @@ -146,7 +147,7 @@ namespace NzbDrone.Update.Test .Throws(new IOException()); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); Mocker.GetMock() @@ -161,7 +162,7 @@ namespace NzbDrone.Update.Test WithServiceRunning(true); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); VerifyServiceRestart(); @@ -174,7 +175,7 @@ namespace NzbDrone.Update.Test WithServiceRunning(false); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); VerifyProcessRestart(); @@ -191,7 +192,7 @@ namespace NzbDrone.Update.Test .Throws(new IOException()); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); VerifyServiceRestart(); @@ -209,7 +210,7 @@ namespace NzbDrone.Update.Test .Throws(new IOException()); - Mocker.Resolve().Start(TARGET_FOLDER); + Mocker.Resolve().Start(TARGET_FOLDER); VerifyProcessRestart(); @@ -237,3 +238,4 @@ namespace NzbDrone.Update.Test } } +*/ diff --git a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs index bd5635971..8c8b5b392 100644 --- a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs +++ b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs @@ -4,7 +4,7 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Test.Common; -using NzbDrone.Update.Providers; +using NzbDrone.Update.UpdateEngine; namespace NzbDrone.Update.Test { @@ -25,7 +25,7 @@ namespace NzbDrone.Update.Test [TestCase(" ")] public void update_should_throw_target_folder_is_blank(string target) { - Assert.Throws(() => Mocker.Resolve().Start(target)) + Assert.Throws(() => Mocker.Resolve().Start(target)) .Message.Should().StartWith("Target folder can not be null or empty"); } @@ -34,7 +34,7 @@ namespace NzbDrone.Update.Test { string targetFolder = "c:\\NzbDrone\\"; - Assert.Throws(() => Mocker.Resolve().Start(targetFolder)) + Assert.Throws(() => Mocker.Resolve().Start(targetFolder)) .Message.Should().StartWith("Target folder doesn't exist"); } @@ -52,7 +52,7 @@ namespace NzbDrone.Update.Test .Setup(c => c.FolderExists(sandboxFolder)) .Returns(false); - Assert.Throws(() => Mocker.Resolve().Start(targetFolder)) + Assert.Throws(() => Mocker.Resolve().Start(targetFolder)) .Message.Should().StartWith("Update folder doesn't exist"); } } diff --git a/NzbDrone.Update/NzbDrone.Update.csproj b/NzbDrone.Update/NzbDrone.Update.csproj index 97e719d0a..e6ca18792 100644 --- a/NzbDrone.Update/NzbDrone.Update.csproj +++ b/NzbDrone.Update/NzbDrone.Update.csproj @@ -69,8 +69,12 @@ - + + + + + @@ -89,6 +93,7 @@ NzbDrone.Common +