From 2f9ca2236831506b6d475f544bed262528923a04 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 7 Mar 2021 00:00:41 +0100 Subject: [PATCH] Fixed failing test (cherry picked from commit 4c324fbbbfc761d7aab459ba70059ba95ab1b286) --- .../UpdateTests/UpdateServiceFixture.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs b/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs index 3470710b2..172e0e733 100644 --- a/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs +++ b/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs @@ -68,6 +68,10 @@ namespace NzbDrone.Core.Test.UpdateTests .Setup(c => c.FolderWritable(It.IsAny())) .Returns(true); + Mocker.GetMock() + .Setup(v => v.FileExists(It.Is(s => s.EndsWith("Sonarr.Update.exe")))) + .Returns(true); + _sandboxFolder = Mocker.GetMock().Object.GetUpdateSandboxFolder(); } @@ -149,7 +153,7 @@ namespace NzbDrone.Core.Test.UpdateTests } [Test] - public void should_start_update_client() + public void should_start_update_client_if_updater_exists() { Subject.Execute(new ApplicationUpdateCommand()); @@ -157,6 +161,21 @@ namespace NzbDrone.Core.Test.UpdateTests .Verify(c => c.Start(It.IsAny(), It.Is(s => s.StartsWith("12")), null, null, null), Times.Once()); } + [Test] + public void should_return_with_warning_if_updater_doesnt_exists() + { + Mocker.GetMock() + .Setup(v => v.FileExists(It.Is(s => s.EndsWith("Sonarr.Update.exe")))) + .Returns(false); + + Subject.Execute(new ApplicationUpdateCommand()); + + Mocker.GetMock() + .Verify(c => c.Start(It.IsAny(), It.IsAny(), null, null, null), Times.Never()); + + ExceptionVerification.ExpectedWarns(1); + } + [Test] public void should_return_without_error_or_warnings_when_no_updates_are_available() {