1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00
Radarr/NzbDrone.Update.Test/InstallUpdateServiceFixture.cs
kay.one d60b863e14 moved data from Roaming to ProgramData.
Cleaned up DiskProvider
2013-07-04 21:43:28 -07:00

59 lines
1.8 KiB
C#

using System;
using System.IO;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Test.Common;
using NzbDrone.Update.UpdateEngine;
namespace NzbDrone.Update.Test
{
[TestFixture]
public class InstallUpdateServiceFixture : TestBase<InstallUpdateService>
{
[SetUp]
public void Setup()
{
Mocker.GetMock<IAppFolderInfo>()
.Setup(c => c.TempFolder).Returns(@"C:\Temp\");
}
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public void update_should_throw_target_folder_is_blank(string target)
{
Assert.Throws<ArgumentException>(() => Subject.Start(target))
.Message.Should().StartWith("Target folder can not be null or empty");
}
[Test]
public void update_should_throw_if_target_folder_doesnt_exist()
{
string targetFolder = "c:\\NzbDrone\\";
Assert.Throws<DirectoryNotFoundException>(() => Subject.Start(targetFolder))
.Message.Should().StartWith("Target folder doesn't exist");
}
[Test]
public void update_should_throw_if_update_folder_doesnt_exist()
{
const string sandboxFolder = @"C:\Temp\NzbDrone_update\nzbdrone";
const string targetFolder = "c:\\NzbDrone\\";
Mocker.GetMock<IDiskProvider>()
.Setup(c => c.FolderExists(targetFolder))
.Returns(true);
Mocker.GetMock<IDiskProvider>()
.Setup(c => c.FolderExists(sandboxFolder))
.Returns(false);
Assert.Throws<DirectoryNotFoundException>(() => Subject.Start(targetFolder))
.Message.Should().StartWith("Update folder doesn't exist");
}
}
}