Added IsTorrentLoaded to tests

Fixes #2103

(cherry picked from commit 7272c5b7fcada0b346e1dd72fb2d1caa6b6e4c63)
This commit is contained in:
Taloth Saldono 2021-03-20 00:33:51 +01:00 committed by Qstick
parent c3176b3cc3
commit 053efd2214
1 changed files with 10 additions and 2 deletions

View File

@ -74,17 +74,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
Mocker.GetMock<IQBittorrentProxy>()
.Setup(s => s.AddTorrentFromUrl(It.IsAny<string>(), It.IsAny<TorrentSeedConfiguration>(), It.IsAny<QBittorrentSettings>()))
.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()
{
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(() =>
{
var torrent = new QBittorrentTorrent
{
Hash = "HASH",
Hash = "CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951",
Name = _title,
Size = 1000,
Progress = 1.0,
@ -138,6 +142,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
.Setup(s => s.GetTorrentFiles(torrent.Hash.ToLower(), It.IsAny<QBittorrentSettings>()))
.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)