From 38a6553654e685c4b6e572ce343dae32fddd4ca1 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 20 Mar 2021 00:33:51 +0100 Subject: [PATCH] Added IsTorrentLoaded to tests Fixes #911 (cherry picked from commit 7272c5b7fcada0b346e1dd72fb2d1caa6b6e4c63) --- .../QBittorrentTests/QBittorrentFixture.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 92e62c474..fc8b47f95 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -74,17 +74,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests Mocker.GetMock() .Setup(s => s.AddTorrentFromUrl(It.IsAny(), It.IsAny(), It.IsAny())) .Throws(); + + Mocker.GetMock() + .Setup(s => s.AddTorrentFromFile(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(); } protected void GivenSuccessfulDownload() { Mocker.GetMock() - .Setup(s => s.AddTorrentFromUrl(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(s => s.AddTorrentFromFile(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .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())) .Returns(new List { new QBittorrentTorrentFile { Name = torrent.Name } }); } + + Mocker.GetMock() + .Setup(s => s.IsTorrentLoaded(It.IsAny(), It.IsAny())) + .Returns((hash, s) => torrents.Any(v => v.Hash.ToLower() == hash)); } private void GivenTorrentFiles(string hash, List files)