mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 19:50:15 -07:00
More update code. almost there.
This commit is contained in:
parent
60d598f2c1
commit
883dffca80
8 changed files with 166 additions and 14 deletions
|
@ -1,68 +0,0 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
using System.IO;
|
||||
using AutoMoq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Update.Providers;
|
||||
|
||||
namespace NzbDrone.Update.Test
|
||||
{
|
||||
[TestFixture]
|
||||
class UpdateProviderVerifyTest : TestBase
|
||||
{
|
||||
|
||||
AutoMoqer mocker = new AutoMoqer();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<EnviromentProvider>()
|
||||
.Setup(c => c.StartUpPath).Returns(@"C:\Temp\NzbDrone_update\");
|
||||
|
||||
mocker.GetMock<EnviromentProvider>()
|
||||
.Setup(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
}
|
||||
|
||||
[TestCase(null)]
|
||||
[TestCase("")]
|
||||
[TestCase(" ")]
|
||||
public void update_should_throw_target_folder_is_blank(string target)
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => mocker.Resolve<UpdateProvider>().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>(() => mocker.Resolve<UpdateProvider>().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<DiskProvider>()
|
||||
.Setup(c => c.FolderExists(targetFolder))
|
||||
.Returns(true);
|
||||
|
||||
mocker.GetMock<DiskProvider>()
|
||||
.Setup(c => c.FolderExists(sandboxFolder))
|
||||
.Returns(false);
|
||||
|
||||
Assert.Throws<DirectoryNotFoundException>(() => mocker.Resolve<UpdateProvider>().Start(targetFolder))
|
||||
.Message.Should().StartWith("Update folder doesn't exist");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue