1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-18 21:35:51 -04:00

fixed more tests.

This commit is contained in:
kay.one
2013-03-31 23:22:16 -07:00
parent 48880e4964
commit 048162a0ef
45 changed files with 424 additions and 677 deletions
@@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
{
public class ImportFileFixture : CoreTest
{
public static object[] ImportTestCases =
@@ -70,10 +70,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
}
@@ -87,20 +87,20 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder<Series>.CreateNew().Build();
var fakeEpisode = Builder<Episode>.CreateNew()
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(g => g.Quality = (Quality)currentFileQuality)
.And(g => g.Proper = currentFileProper).Build()
.With(g => g.Quality = new QualityModel(currentFileQuality, currentFileProper))
.Build()
).Build();
With80MBFile();
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
}
@@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder<Series>.CreateNew().Build();
var fakeEpisode = Builder<Episode>.CreateNew()
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(e => e.Quality = Quality.Bluray720p).Build()
.With(e => e.Quality = new QualityModel(Quality.Bluray720p)).Build()
)
.Build();
@@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifySkipImport(result, Mocker);
}
@@ -146,10 +146,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifySkipImport(result, Mocker);
ExceptionVerification.ExpectedWarns(1);
}
@@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifySkipImport(result, Mocker);
}
@@ -199,10 +199,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(new List<Episode>());
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifySkipImport(result, Mocker);
}
@@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder<Series>.CreateNew().Build();
var fakeEpisode = Builder<Episode>.CreateNew()
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(e => e.Quality = Quality.SDTV).Build()
.With(e => e.Quality = new QualityModel(Quality.SDTV)).Build()
)
.Build();
@@ -228,10 +228,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
}
@@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.Quality = Quality.SDTV)
.With(f => f.Quality = new QualityModel(Quality.SDTV))
.Build())
.Build().ToList();
@@ -260,10 +260,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE);
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
}
@@ -278,12 +278,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.Quality = Quality.Bluray720p)
.With(f => f.Quality = new QualityModel(Quality.Bluray720p))
.Build())
.Build().ToList();
//Mocks
With80MBFile();
Mocker.GetMock<IMediaFileService>()
@@ -293,10 +293,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifySkipImport(result, Mocker);
}
@@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
.All()
.With(e => e.Quality = Quality.SDTV)
.With(e => e.Quality = new QualityModel(Quality.SDTV))
.Build();
var fakeEpisode1 = Builder<Episode>.CreateNew()
@@ -331,10 +331,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifyFileImport(result, Mocker, fakeEpisode1, SIZE);
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Exactly(2));
}
@@ -358,12 +358,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode});
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
Mocker.GetMock<DiskProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Never());
}
@@ -377,7 +377,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Build();
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
With80MBFile();
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
@@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
{
[TestFixture]
public class BlackholeProviderFixture : CoreTest
{
private const string nzbUrl = "http://www.nzbs.com/url";
private const string title = "some_nzb_title";
private const string blackHoleFolder = @"d:\nzb\blackhole\";
private const string nzbPath = @"d:\nzb\blackhole\some_nzb_title.nzb";
[SetUp]
public void Setup()
{
Mocker.GetMock<IConfigService>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
}
private void WithExistingFile()
{
Mocker.GetMock<DiskProvider>().Setup(c => c.FileExists(nzbPath)).Returns(true);
}
private void WithFailedDownload()
{
Mocker.GetMock<HttpProvider>().Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>())).Throws(new WebException());
}
[Test]
public void DownloadNzb_should_download_file_if_it_doesnt_exist()
{
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once());
}
[Test]
public void DownloadNzb_not_download_file_if_it_doesn_exist()
{
WithExistingFile();
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
}
[Test]
public void should_return_false_on_failed_download()
{
WithFailedDownload();
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_replace_illegal_characters_in_title()
{
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
var expectedFilename = Path.Combine(blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}
}
}
@@ -1,66 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
{
public class DownloadNzbFixture : CoreTest
{
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
fakeConfig.SetupGet(c => c.NzbgetPassword).Returns("pass");
fakeConfig.SetupGet(c => c.NzbgetTvCategory).Returns("TV");
fakeConfig.SetupGet(c => c.NzbgetBacklogTvPriority).Returns(PriorityType.Normal);
fakeConfig.SetupGet(c => c.NzbgetRecentTvPriority).Returns(PriorityType.High);
}
private void WithFailResponse()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny<String>()))
.Returns(ReadAllText("Files", "Nzbget", "JsonError.txt"));
}
[Test]
public void should_add_item_to_queue()
{
const string url = "http://www.nzbdrone.com";
const string title = "30 Rock - S01E01 - Pilot [HDTV-720p]";
Mocker.GetMock<HttpProvider>()
.Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass",
It.Is<String>(c => c.Equals("{\"method\":\"appendurl\",\"params\":[\"30 Rock - S01E01 - Pilot [HDTV-720p]\",\"TV\",0,false,\"http://www.nzbdrone.com\"]}"))))
.Returns("{\"version\": \"1.1\",\"result\": true}");
Mocker.Resolve<NzbgetProvider>()
.DownloadNzb(url, title, false)
.Should()
.BeTrue();
}
[Test]
public void should_throw_when_error_is_returned()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Mocker.Resolve<NzbgetProvider>().DownloadNzb("http://www.nzbdrone.com", "30 Rock - S01E01 - Pilot [HDTV-720p]", false));
}
}
}
@@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
{
public class QueueFixture : CoreTest
{
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
fakeConfig.SetupGet(c => c.NzbgetPassword).Returns("pass");
fakeConfig.SetupGet(c => c.NzbgetTvCategory).Returns("TV");
fakeConfig.SetupGet(c => c.NzbgetBacklogTvPriority).Returns(PriorityType.Normal);
fakeConfig.SetupGet(c => c.NzbgetRecentTvPriority).Returns(PriorityType.High);
}
private void WithFullQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny<String>()))
.Returns(ReadAllText("Files", "Nzbget", "Queue.txt"));
}
private void WithEmptyQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny<String>()))
.Returns(ReadAllText("Files", "Nzbget", "Queue_empty.txt"));
}
private void WithFailResponse()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny<String>()))
.Returns(ReadAllText("Files", "Nzbget", "JsonError.txt"));
}
[Test]
public void should_return_no_items_when_queue_is_empty()
{
WithEmptyQueue();
Mocker.Resolve<NzbgetProvider>()
.GetQueue()
.Should()
.BeEmpty();
}
[Test]
public void should_return_item_when_queue_has_item()
{
WithFullQueue();
Mocker.Resolve<NzbgetProvider>()
.GetQueue()
.Should()
.HaveCount(1);
}
[Test]
public void should_throw_when_error_is_returned()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Mocker.Resolve<NzbgetProvider>().GetQueue());
}
}
}
@@ -1,91 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
{
[TestFixture]
public class PneumaticProviderFixture : CoreTest
{
private const string nzbUrl = "http://www.nzbs.com/url";
private const string title = "30.Rock.S01E05.hdtv.xvid-LoL";
private const string pneumaticFolder = @"d:\nzb\pneumatic\";
private const string sabDrop = @"d:\unsorted tv\";
private string nzbPath;
[SetUp]
public void Setup()
{
nzbPath = pneumaticFolder + title + ".nzb";
Mocker.GetMock<IConfigService>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
}
private void WithExistingFile()
{
Mocker.GetMock<DiskProvider>().Setup(c => c.FileExists(nzbPath)).Returns(true);
}
private void WithFailedDownload()
{
Mocker.GetMock<HttpProvider>().Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>())).Throws(new WebException());
}
[Test]
public void should_download_file_if_it_doesnt_exist()
{
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once());
}
[Test]
public void should_not_download_file_if_it_doesn_exist()
{
WithExistingFile();
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
}
[Test]
public void should_return_false_on_failed_download()
{
WithFailedDownload();
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, title, false).Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_skip_if_full_season_download()
{
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, "30 Rock - Season 1", false).Should().BeFalse();
}
[Test]
public void should_replace_illegal_characters_in_title()
{
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
var expectedFilename = Path.Combine(pneumaticFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}
}
}
@@ -1,331 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
{
[TestFixture]
public class QueueFixture : CoreTest
{
[SetUp]
public void Setup()
{
string sabHost = "192.168.5.55";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";
string cat = "tv";
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.SabHost).Returns(sabHost);
fakeConfig.SetupGet(c => c.SabPort).Returns(sabPort);
fakeConfig.SetupGet(c => c.SabApiKey).Returns(apikey);
fakeConfig.SetupGet(c => c.SabUsername).Returns(username);
fakeConfig.SetupGet(c => c.SabPassword).Returns(password);
fakeConfig.SetupGet(c => c.SabTvCategory).Returns(cat);
}
private void WithFullQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(
s =>
s.DownloadString(
"http://192.168.5.55:2222/api?mode=queue&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files","Queue.txt"));
}
private void WithEmptyQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files","QueueEmpty.txt"));
}
private void WithFailResponse()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString(It.IsAny<String>())).Returns(ReadAllText("Files","JsonError.txt"));
}
private void WithUnknownPriorityQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(
s =>
s.DownloadString(
"http://192.168.5.55:2222/api?mode=queue&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files", "QueueUnknownPriority.txt"));
}
[Test]
public void GetQueue_should_return_an_empty_list_when_the_queue_is_empty()
{
WithEmptyQueue();
var result = Mocker.Resolve<SabProvider>().GetQueue();
result.Should().BeEmpty();
}
[Test]
public void GetQueue_should_throw_when_there_is_an_error_getting_the_queue()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().GetQueue(), "API Key Incorrect");
}
[Test]
public void GetQueue_should_return_a_list_with_items_when_the_queue_has_items()
{
WithFullQueue();
var result = Mocker.Resolve<SabProvider>().GetQueue();
result.Should().HaveCount(7);
}
[Test]
public void GetQueue_should_return_a_list_with_items_even_when_priority_is_non_standard()
{
WithUnknownPriorityQueue();
var result = Mocker.Resolve<SabProvider>().GetQueue();
result.Should().HaveCount(7);
result.Should().OnlyContain(i => i.Priority == SabPriorityType.Normal);
}
[Test]
public void is_in_queue_should_find_if_exact_episode_is_in_queue()
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int> { 5 },
SeasonNumber = 1,
Quality = new QualityModel { Quality = Quality.SDTV, Proper = false },
Series = new Series { Title = "30 Rock", CleanTitle = Parser.NormalizeTitle("30 Rock") },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
[Test]
public void is_in_queue_should_find_if_exact_daily_episode_is_in_queue()
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
AirDate = new DateTime(2011, 12, 01),
Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesTypes.Daily },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
[Test]
public void is_in_queue_should_find_if_exact_full_season_release_is_in_queue()
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
FullSeason = true,
SeasonNumber = 5,
Series = new Series { Title = "My Name is earl", CleanTitle = Parser.NormalizeTitle("My Name is earl") },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
public static object[] DifferentEpisodeCases =
{
new object[] { 2, new[] { 5 }, "30 Rock", Quality.Bluray1080p, true }, //Same Series, Different Season, Episode
new object[] { 1, new[] { 6 }, "30 Rock", Quality.Bluray1080p, true }, //Same series, different episodes
new object[] { 1, new[] { 6, 7, 8 }, "30 Rock", Quality.Bluray1080p, true }, //Same series, different episodes
new object[] { 1, new[] { 6 }, "Some other show", Quality.Bluray1080p, true }, //Different series, same season, episode
new object[] { 1, new[] { 5 }, "Rock", Quality.Bluray1080p, true }, //Similar series, same season, episodes
new object[] { 1, new[] { 5 }, "30 Rock", Quality.Bluray720p, false }, //Same series, higher quality
new object[] { 1, new[] { 5 }, "30 Rock", Quality.HDTV720p, true } //Same series, higher quality
};
[Test, TestCaseSource("DifferentEpisodeCases")]
public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] episodes, string title, Quality qualityType, bool proper)
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
SeasonNumber = season,
Quality = new QualityModel { Quality = qualityType, Proper = proper },
Series = new Series { Title = title, CleanTitle = Parser.NormalizeTitle(title) },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeFalse();
}
public static object[] LowerQualityCases =
{
new object[] { 1, new[] { 5 }, "30 Rock", Quality.SDTV, false }, //Same Series, lower quality
new object[] { 1, new[] { 5 }, "30 rocK", Quality.SDTV, false }, //Same Series, different casing
new object[] { 1, new[] { 5 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality
new object[] { 1, new[] { 5, 6 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality, one different episode
new object[] { 1, new[] { 5, 6 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality, one different episode
new object[] { 4, new[] { 8 }, "Parks and Recreation", Quality.WEBDL720p, false }, //Same Series, same quality
};
[Test, TestCaseSource("LowerQualityCases")]
public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season, int[] episodes, string title, Quality qualityType, bool proper)
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
SeasonNumber = season,
Quality = new QualityModel { Quality = qualityType, Proper = proper },
Series = new Series { Title = title, CleanTitle = Parser.NormalizeTitle(title) },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
public static object[] DuplicateItemsCases =
{
new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.SDTV, false }, //Same Series, lower quality
new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.HDTV720p, false }, //Same Series, same quality
new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.HDTV720p, true }, //Same Series, same quality
new object[] { 5, new[] { 13, 14 }, "The Big Bang Theory", Quality.HDTV720p, false } //Same Series, same quality, one diffrent episode
};
[Test, TestCaseSource("DuplicateItemsCases")]
public void IsInQueue_should_find_items_marked_as_duplicate(int season, int[] episodes, string title, Quality qualityType, bool proper)
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
SeasonNumber = season,
Quality = new QualityModel { Quality = qualityType, Proper = proper },
Series = new Series { Title = title, CleanTitle = Parser.NormalizeTitle(title) },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
public static object[] DoubleEpisodeCases =
{
new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", Quality.Bluray720p, false },
new object[] { 3, new[] { 15 }, "My Name Is Earl", Quality.DVD, false },
new object[] { 3, new[] { 14 }, "My Name Is Earl", Quality.HDTV720p, false },
new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", Quality.SDTV, false }
};
[Test, TestCaseSource("DoubleEpisodeCases")]
public void IsInQueue_should_find_double_episodes_(int season, int[] episodes, string title, Quality qualityType, bool proper)
{
WithFullQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
SeasonNumber = season,
Quality = new QualityModel { Quality = qualityType, Proper = proper },
Series = new Series { Title = title, CleanTitle = Parser.NormalizeTitle(title) },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeTrue();
}
[Test]
public void IsInQueue_should_return_false_if_queue_is_empty()
{
WithEmptyQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int> { 1 },
SeasonNumber = 2,
Quality = new QualityModel { Quality = Quality.Bluray1080p, Proper = true },
Series = new Series { Title = "Test", CleanTitle = Parser.NormalizeTitle("Test") },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeFalse();
}
[Test]
public void GetQueue_should_parse_timeleft_with_hours_greater_than_24_hours()
{
WithFullQueue();
var result = Mocker.Resolve<SabProvider>().GetQueue();
result.Should().NotBeEmpty();
var timeleft = result.First(q => q.Id == "SABnzbd_nzo_qv6ilb").Timeleft;
timeleft.Days.Should().Be(2);
timeleft.Hours.Should().Be(9);
timeleft.Minutes.Should().Be(27);
timeleft.Seconds.Should().Be(45);
}
[TearDown]
public void TearDown()
{
ExceptionVerification.IgnoreWarns();
}
}
}
@@ -1,252 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Model;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
{
[TestFixture]
public class SabProviderFixture : CoreTest
{
private const string url = "http://www.nzbclub.com/nzb_download.aspx?mid=1950232";
private const string title = "My Series Name - 5x2-5x3 - My title [Bluray720p] [Proper]";
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.SabHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.SabPort).Returns(2222);
fakeConfig.SetupGet(c => c.SabApiKey).Returns("5c770e3197e4fe763423ee7c392c25d1");
fakeConfig.SetupGet(c => c.SabUsername).Returns("admin");
fakeConfig.SetupGet(c => c.SabPassword).Returns("pass");
fakeConfig.SetupGet(c => c.SabTvCategory).Returns("tv");
}
private void WithFailResponse()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString(It.IsAny<String>())).Returns("{ \"status\": false, \"error\": \"API Key Required\" }");
}
[Test]
public void add_url_should_format_request_properly()
{
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns("{ \"status\": true }");
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
}
[Test]
public void add_by_url_should_detect_and_handle_sab_errors()
{
WithFailResponse();
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeFalse());
//ExceptionVerification.ExpectedErrors(1);
}
[Test]
public void should_be_able_to_get_categories_when_config_is_passed_in()
{
const string host = "192.168.5.22";
const int port = 1111;
const string apikey = "5c770e3197e4fe763423ee7c392c25d2";
const string username = "admin2";
const string password = "pass2";
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
.Setup(s => s.DownloadString("http://192.168.5.22:1111/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d2&ma_username=admin2&ma_password=pass2"))
.Returns(ReadAllText("Files","Categories_json.txt"));
var result = Mocker.Resolve<SabProvider>().GetCategories(host, port, apikey, username, password);
result.Should().NotBeNull();
result.categories.Should().NotBeEmpty();
}
[Test]
public void should_be_able_to_get_categories_using_config()
{
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files","Categories_json.txt"));
var result = Mocker.Resolve<SabProvider>().GetCategories();
result.Should().NotBeNull();
result.categories.Should().NotBeEmpty();
}
[Test]
public void GetHistory_should_return_a_list_with_items_when_the_history_has_items()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files", "History.txt"));
var result = Mocker.Resolve<SabProvider>().GetHistory();
result.Should().HaveCount(1);
}
[Test]
public void GetHistory_should_return_an_empty_list_when_the_queue_is_empty()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files","HistoryEmpty.txt"));
var result = Mocker.Resolve<SabProvider>().GetHistory();
result.Should().BeEmpty();
}
[Test]
public void GetHistory_should_return_an_empty_list_when_there_is_an_error_getting_the_queue()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(ReadAllText("Files","JsonError.txt"));
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().GetHistory(), "API Key Incorrect");
}
[Test]
public void GetVersion_should_return_the_version_using_passed_in_values()
{
var response = "{ \"version\": \"0.6.9\" }";
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(response);
var result = Mocker.Resolve<SabProvider>().GetVersion("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass");
result.Should().NotBeNull();
result.Version.Should().Be("0.6.9");
}
[Test]
public void GetVersion_should_return_the_version_using_saved_values()
{
var response = "{ \"version\": \"0.6.9\" }";
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(response);
var result = Mocker.Resolve<SabProvider>().GetVersion();
result.Should().NotBeNull();
result.Version.Should().Be("0.6.9");
}
[Test]
public void Test_should_return_version_as_a_string()
{
var response = "{ \"version\": \"0.6.9\" }";
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(response);
var result = Mocker.Resolve<SabProvider>().Test("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass");
result.Should().Be("0.6.9");
}
[Test]
public void should_return_false_when_WebException_is_thrown()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString(It.IsAny<String>())).Throws(new WebException());
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeFalse();
ExceptionVerification.ExpectedErrors(1);
}
[Test]
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns("{ \"status\": true }");
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, true).Should().BeTrue();
Mocker.GetMock<HttpProvider>()
.Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once());
}
[Test]
public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false()
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns("{ \"status\": true }");
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
Mocker.GetMock<HttpProvider>()
.Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once());
}
}
}
@@ -1,92 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Download;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
{
[TestFixture]
public class ContainsRecentEpisode : CoreTest
{
private Episode _recentEpisode;
private Episode _oldEpisode;
[SetUp]
public void Setup()
{
_recentEpisode = Builder<Episode>
.CreateNew()
.With(e => e.AirDate = DateTime.Today)
.Build();
_oldEpisode = Builder<Episode>
.CreateNew()
.With(e => e.AirDate = DateTime.Today.AddDays(-365))
.Build();
}
[Test]
public void should_return_true_if_episode_aired_recently()
{
var epr = Builder<EpisodeParseResult>
.CreateNew()
.With(p => p.Episodes = new List<Episode>
{
_recentEpisode
})
.Build();
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeTrue();
}
[Test]
public void should_return_true_if_one_episode_aired_recently()
{
var epr = Builder<EpisodeParseResult>
.CreateNew()
.With(p => p.Episodes = new List<Episode>
{
_recentEpisode,
_oldEpisode
})
.Build();
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeTrue();
}
[Test]
public void should_return_false_if_episode_did_not_air_recently()
{
var epr = Builder<EpisodeParseResult>
.CreateNew()
.With(p => p.Episodes = new List<Episode>
{
_oldEpisode
})
.Build();
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeFalse();
}
[Test]
public void should_return_false_if_no_episode_aired_recently()
{
var epr = Builder<EpisodeParseResult>
.CreateNew()
.With(p => p.Episodes = new List<Episode>
{
_oldEpisode,
_oldEpisode
})
.Build();
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeFalse();
}
}
}
@@ -1,128 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
{
[TestFixture]
public class DownloadProviderFixture : CoreTest<DownloadProvider>
{
private void SetDownloadClient(DownloadClientType clientType)
{
Mocker.GetMock<IConfigService>()
.Setup(c => c.DownloadClient)
.Returns(clientType);
}
private EpisodeParseResult SetupParseResult()
{
var episodes = Builder<Episode>.CreateListOfSize(2)
.TheFirst(1).With(s => s.Id = 12)
.TheNext(1).With(s => s.Id = 99)
.All().With(s => s.SeriesId = 5)
.Build().ToList();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(episodes);
return Builder<EpisodeParseResult>.CreateNew()
.With(c => c.Quality = new QualityModel(Quality.DVD, false))
.With(c => c.Series = Builder<Series>.CreateNew().Build())
.With(c => c.EpisodeNumbers = new List<int> { 2 })
.With(c => c.Episodes = episodes)
.Build();
}
private void WithSuccessfullAdd()
{
Mocker.GetMock<SabProvider>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
.Returns(true);
Mocker.GetMock<BlackholeProvider>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
.Returns(true);
}
private void WithFailedAdd()
{
Mocker.GetMock<SabProvider>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
.Returns(false);
Mocker.GetMock<BlackholeProvider>()
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
.Returns(false);
}
[Test]
public void Download_report_should_publish_on_grab_event()
{
WithSuccessfullAdd();
SetDownloadClient(DownloadClientType.Sabnzbd);
var parseResult = SetupParseResult();
Subject.DownloadReport(parseResult);
Mocker.GetMock<SabProvider>()
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Once());
Mocker.GetMock<BlackholeProvider>()
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Never());
VerifyEventPublished<EpisodeGrabbedEvent>();
}
[TestCase(DownloadClientType.Sabnzbd)]
[TestCase(DownloadClientType.Blackhole)]
public void Download_report_should_not_publish_grabbed_event(DownloadClientType clientType)
{
WithFailedAdd();
SetDownloadClient(clientType);
var parseResult = SetupParseResult();
Subject.DownloadReport(parseResult);
VerifyEventNotPublished<EpisodeGrabbedEvent>();
}
[Test]
public void should_return_sab_as_active_client()
{
SetDownloadClient(DownloadClientType.Sabnzbd);
Subject.GetActiveDownloadClient().Should().BeAssignableTo<SabProvider>();
}
[Test]
public void should_return_blackhole_as_active_client()
{
SetDownloadClient(DownloadClientType.Blackhole);
Subject.GetActiveDownloadClient().Should().BeAssignableTo<BlackholeProvider>();
}
}
}