|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using Moq;
|
|
|
|
@ -9,7 +9,6 @@ using NzbDrone.Core.Download;
|
|
|
|
|
using NzbDrone.Core.Download.TrackedDownloads;
|
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
|
using NzbDrone.Core.MediaFiles.Commands;
|
|
|
|
|
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
|
|
|
|
using NzbDrone.Core.MediaFiles.TrackImport;
|
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
@ -19,7 +18,7 @@ using NzbDrone.Test.Common;
|
|
|
|
|
namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class DownloadedEpisodesCommandServiceFixture : CoreTest<DownloadedEpisodesCommandService>
|
|
|
|
|
public class DownloadedAlbumsCommandServiceFixture : CoreTest<DownloadedAlbumsCommandService>
|
|
|
|
|
{
|
|
|
|
|
private string _droneFactory = "c:\\drop\\".AsOsAgnostic();
|
|
|
|
|
private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic();
|
|
|
|
@ -82,7 +81,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFolder(_droneFactory);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand());
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
|
|
|
|
|
}
|
|
|
|
@ -90,7 +89,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_skip_import_if_dronefactory_doesnt_exist()
|
|
|
|
|
{
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand());
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Never());
|
|
|
|
|
|
|
|
|
@ -102,7 +101,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFolder(_droneFactory);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { DownloadClientId = "sab1" });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { DownloadClientId = "sab1" });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
|
|
|
|
|
}
|
|
|
|
@ -112,7 +111,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFolder(_downloadFolder);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
|
|
|
|
}
|
|
|
|
@ -122,7 +121,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFile(_downloadFile);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFile });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
|
|
|
|
}
|
|
|
|
@ -133,7 +132,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
GivenExistingFolder(_downloadFolder);
|
|
|
|
|
GivenValidQueueItem();
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, _trackedDownload.RemoteEpisode.Series, _trackedDownload.DownloadItem), Times.Once());
|
|
|
|
|
}
|
|
|
|
@ -143,7 +142,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFolder(_downloadFolder);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, null, null), Times.Once());
|
|
|
|
|
|
|
|
|
@ -153,7 +152,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_warn_if_neither_folder_or_file_exists()
|
|
|
|
|
{
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Never());
|
|
|
|
|
|
|
|
|
@ -165,7 +164,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|
|
|
|
{
|
|
|
|
|
GivenExistingFile(_downloadFile);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy });
|
|
|
|
|
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Copy, null, null), Times.Once());
|
|
|
|
|
}
|