|
|
@ -4,6 +4,7 @@ using System.IO;
|
|
|
|
using System.IO.Abstractions;
|
|
|
|
using System.IO.Abstractions;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Net;
|
|
|
|
using System.Net;
|
|
|
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Moq;
|
|
|
|
using Moq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NUnit.Framework;
|
|
|
@ -26,6 +27,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
protected string _blackholeFolder;
|
|
|
|
protected string _blackholeFolder;
|
|
|
|
protected string _filePath;
|
|
|
|
protected string _filePath;
|
|
|
|
protected string _magnetFilePath;
|
|
|
|
protected string _magnetFilePath;
|
|
|
|
|
|
|
|
protected DownloadClientItem _downloadClientItem;
|
|
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
public void Setup()
|
|
|
@ -34,6 +36,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
_blackholeFolder = @"c:\blackhole\torrent".AsOsAgnostic();
|
|
|
|
_blackholeFolder = @"c:\blackhole\torrent".AsOsAgnostic();
|
|
|
|
_filePath = (@"c:\blackhole\torrent\" + _title + ".torrent").AsOsAgnostic();
|
|
|
|
_filePath = (@"c:\blackhole\torrent\" + _title + ".torrent").AsOsAgnostic();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_downloadClientItem = Builder<DownloadClientItem>
|
|
|
|
|
|
|
|
.CreateNew().With(d => d.DownloadId = "_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.SetConstant<IScanWatchFolder>(Mocker.Resolve<ScanWatchFolder>());
|
|
|
|
Mocker.SetConstant<IScanWatchFolder>(Mocker.Resolve<ScanWatchFolder>());
|
|
|
|
|
|
|
|
|
|
|
|
Subject.Definition = new DownloadClientDefinition();
|
|
|
|
Subject.Definition = new DownloadClientDefinition();
|
|
|
@ -248,7 +254,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
.Setup(c => c.FileExists(It.IsAny<string>()))
|
|
|
|
.Setup(c => c.FileExists(It.IsAny<string>()))
|
|
|
|
.Returns(true);
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
|
Subject.RemoveItem("_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0", true);
|
|
|
|
Subject.RemoveItem(_downloadClientItem, true);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Once());
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Once());
|
|
|
@ -263,7 +269,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
.Setup(c => c.FolderExists(It.IsAny<string>()))
|
|
|
|
.Setup(c => c.FolderExists(It.IsAny<string>()))
|
|
|
|
.Returns(true);
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
|
Subject.RemoveItem("_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0", true);
|
|
|
|
Subject.RemoveItem(_downloadClientItem, true);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Verify(c => c.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
|
|
|
.Verify(c => c.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
|
|
@ -272,7 +278,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void RemoveItem_should_ignore_if_unknown_item()
|
|
|
|
public void RemoveItem_should_ignore_if_unknown_item()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Subject.RemoveItem("_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0", true);
|
|
|
|
Subject.RemoveItem(_downloadClientItem, true);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
|
|
@ -286,7 +292,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GivenCompletedItem();
|
|
|
|
GivenCompletedItem();
|
|
|
|
|
|
|
|
|
|
|
|
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem("_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0", false));
|
|
|
|
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem(_downloadClientItem, false));
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
|
|
|
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
|
|
|