2013-04-16 00:08:06 +00:00
|
|
|
|
using Moq;
|
2012-09-23 06:01:31 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Common;
|
2013-02-24 06:48:52 +00:00
|
|
|
|
using NzbDrone.Core.Configuration;
|
2013-03-05 05:51:07 +00:00
|
|
|
|
using NzbDrone.Core.Jobs.Implementations;
|
2012-09-23 06:01:31 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.JobTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-04-16 04:52:41 +00:00
|
|
|
|
public class PostDownloadScanJobFixture : CoreTest<PostDownloadScanJob>
|
2012-09-23 06:01:31 +00:00
|
|
|
|
{
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<DiskProvider>().Setup(s => s.FolderExists(It.IsAny<string>())).Returns(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_options_Path_when_provided()
|
|
|
|
|
{
|
|
|
|
|
var path = @"C:\Test\Unsorted TV";
|
|
|
|
|
|
2013-04-16 00:08:06 +00:00
|
|
|
|
Mocker.GetMock<IDropFolderImportService>().Setup(s => s.ProcessDropFolder(path));
|
|
|
|
|
Subject.Start(MockNotification, new { Path = path });
|
2012-09-23 06:01:31 +00:00
|
|
|
|
|
2013-04-16 00:08:06 +00:00
|
|
|
|
Mocker.GetMock<IDropFolderImportService>().Verify(s => s.ProcessDropFolder(path), Times.Once());
|
2012-09-23 06:01:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_get_sabDropDir_when_path_is_supplied()
|
|
|
|
|
{
|
|
|
|
|
var path = @"C:\Test\Unsorted TV";
|
|
|
|
|
|
2013-04-16 00:08:06 +00:00
|
|
|
|
Mocker.GetMock<IDropFolderImportService>().Setup(s => s.ProcessDropFolder(path));
|
|
|
|
|
Subject.Start(MockNotification, new { Path = path });
|
2012-09-23 06:01:31 +00:00
|
|
|
|
|
2013-02-24 19:39:31 +00:00
|
|
|
|
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
|
2012-09-23 06:01:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_get_sabDropDir_when_path_is_not_supplied()
|
|
|
|
|
{
|
|
|
|
|
var path = @"C:\Test\Unsorted TV";
|
|
|
|
|
|
2013-02-24 19:39:31 +00:00
|
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
2013-04-16 00:08:06 +00:00
|
|
|
|
Subject.Start(MockNotification, null);
|
2012-09-23 06:01:31 +00:00
|
|
|
|
|
2013-02-24 19:39:31 +00:00
|
|
|
|
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
|
2012-09-23 06:01:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_sabDropDir_when_options_Path_is_not_provided()
|
|
|
|
|
{
|
|
|
|
|
var path = @"C:\Test\Unsorted TV";
|
|
|
|
|
|
2013-02-24 19:39:31 +00:00
|
|
|
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
|
2013-04-16 00:08:06 +00:00
|
|
|
|
|
|
|
|
|
Subject.Start(MockNotification, null);
|
2012-09-23 06:01:31 +00:00
|
|
|
|
|
2013-04-16 00:08:06 +00:00
|
|
|
|
Mocker.GetMock<IDropFolderImportService>().Verify(s => s.ProcessDropFolder(path), Times.Once());
|
2012-09-23 06:01:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|