You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.Core.Test/JobTests/PostDownloadScanJobFixture.cs

66 lines
2.2 KiB

12 years ago
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Implementations;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.JobTests
{
[TestFixture]
12 years ago
public class PostDownloadScanJobFixture : CoreTest<PostDownloadScanJob>
{
[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";
12 years ago
Mocker.GetMock<IDropFolderImportService>().Setup(s => s.ProcessDropFolder(path));
Subject.Start(MockNotification, new { Path = path });
12 years ago
Mocker.GetMock<IDropFolderImportService>().Verify(s => s.ProcessDropFolder(path), Times.Once());
}
[Test]
public void should_not_get_sabDropDir_when_path_is_supplied()
{
var path = @"C:\Test\Unsorted TV";
12 years ago
Mocker.GetMock<IDropFolderImportService>().Setup(s => s.ProcessDropFolder(path));
Subject.Start(MockNotification, new { Path = path });
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
}
[Test]
public void should_get_sabDropDir_when_path_is_not_supplied()
{
var path = @"C:\Test\Unsorted TV";
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
12 years ago
Subject.Start(MockNotification, null);
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
}
[Test]
public void should_use_sabDropDir_when_options_Path_is_not_provided()
{
var path = @"C:\Test\Unsorted TV";
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
12 years ago
Subject.Start(MockNotification, null);
12 years ago
Mocker.GetMock<IDropFolderImportService>().Verify(s => s.ProcessDropFolder(path), Times.Once());
}
}
}