|
|
@ -74,17 +74,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
.Setup(s => s.AddTorrentFromUrl(It.IsAny<string>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Setup(s => s.AddTorrentFromUrl(It.IsAny<string>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Throws<InvalidOperationException>();
|
|
|
|
.Throws<InvalidOperationException>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
|
|
|
|
.Setup(s => s.AddTorrentFromFile(It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
|
|
|
|
.Throws<InvalidOperationException>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void GivenSuccessfulDownload()
|
|
|
|
protected void GivenSuccessfulDownload()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
.Setup(s => s.AddTorrentFromUrl(It.IsAny<string>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Setup(s => s.AddTorrentFromFile(It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Callback(() =>
|
|
|
|
.Callback(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var torrent = new QBittorrentTorrent
|
|
|
|
var torrent = new QBittorrentTorrent
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Hash = "HASH",
|
|
|
|
Hash = "CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951",
|
|
|
|
Name = _title,
|
|
|
|
Name = _title,
|
|
|
|
Size = 1000,
|
|
|
|
Size = 1000,
|
|
|
|
Progress = 1.0,
|
|
|
|
Progress = 1.0,
|
|
|
@ -138,6 +142,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
|
|
|
.Setup(s => s.GetTorrentFiles(torrent.Hash.ToLower(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Setup(s => s.GetTorrentFiles(torrent.Hash.ToLower(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
.Returns(new List<QBittorrentTorrentFile> { new QBittorrentTorrentFile { Name = torrent.Name } });
|
|
|
|
.Returns(new List<QBittorrentTorrentFile> { new QBittorrentTorrentFile { Name = torrent.Name } });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IQBittorrentProxy>()
|
|
|
|
|
|
|
|
.Setup(s => s.IsTorrentLoaded(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()))
|
|
|
|
|
|
|
|
.Returns<string, QBittorrentSettings>((hash, s) => torrents.Any(v => v.Hash.ToLower() == hash));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void GivenTorrentFiles(string hash, List<QBittorrentTorrentFile> files)
|
|
|
|
private void GivenTorrentFiles(string hash, List<QBittorrentTorrentFile> files)
|
|
|
|