|
|
@ -14,7 +14,7 @@ using NzbDrone.Core.Test.Framework;
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
[TestFixture]
|
|
|
|
internal class PreformUpdateFixture : CoreTest
|
|
|
|
internal class StartUpdateFixture : CoreTest
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
|
|
|
|
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
|
|
|
|
|
|
|
|
|
|
|
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
|
|
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
|
|
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
|
|
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<HttpProvider>().Verify(
|
|
|
|
Mocker.GetMock<HttpProvider>().Verify(
|
|
|
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
|
|
|
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<ArchiveProvider>().Verify(
|
|
|
|
Mocker.GetMock<ArchiveProvider>().Verify(
|
|
|
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
|
|
|
|
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(
|
|
|
|
Mocker.GetMock<DiskProvider>().Verify(
|
|
|
@ -108,13 +108,13 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
|
|
|
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Mocker.GetMock<ProcessProvider>().Verify(
|
|
|
|
Mocker.GetMock<ProcessProvider>().Verify(
|
|
|
|
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
|
|
|
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
|
|
|
p.FileName == updateClientPath &&
|
|
|
|
p.FileName == updateClientPath &&
|
|
|
|
p.Arguments == "/12 /" + _clientGuid.ToString())
|
|
|
|
p.Arguments == "12 " + _clientGuid.ToString())
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
|
|
|
Mocker.Resolve<HttpProvider>();
|
|
|
|
Mocker.Resolve<HttpProvider>();
|
|
|
|
Mocker.Resolve<DiskProvider>();
|
|
|
|
Mocker.Resolve<DiskProvider>();
|
|
|
|
Mocker.Resolve<ArchiveProvider>();
|
|
|
|
Mocker.Resolve<ArchiveProvider>();
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage);
|
|
|
|
Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
|
|
|
|
updateSubFolder.Refresh();
|
|
|
|
updateSubFolder.Refresh();
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
|