automatically download banner,poster, fanart. without a job :D
This commit is contained in:
@@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test
|
||||
public string create_proper_sab_daily_titles(bool proper)
|
||||
{
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesType = SeriesType.Daily)
|
||||
.With(c => c.SeriesTypes = SeriesTypes.Daily)
|
||||
.With(c => c.Title = "My Series Name")
|
||||
.Build();
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class BannerDownloadJobTest : CoreTest
|
||||
{
|
||||
private ProgressNotification _notification;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_notification = new ProgressNotification("Test");
|
||||
WithTempAsAppPath();
|
||||
}
|
||||
|
||||
private void WithSuccessfulDownload()
|
||||
{
|
||||
Mocker.GetMock<BannerProvider>()
|
||||
.Setup(s => s.Download(It.IsAny<Series>()))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
private void WithFailedDownload()
|
||||
{
|
||||
Mocker.GetMock<BannerProvider>()
|
||||
.Setup(s => s.Download(It.IsAny<Series>()))
|
||||
.Returns(false);
|
||||
}
|
||||
|
||||
private void VerifyDownloadMock(int times)
|
||||
{
|
||||
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(It.IsAny<Series>()), Times.Exactly(times));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Start_should_download_banners_for_all_series_when_no_targetId_is_passed_in()
|
||||
{
|
||||
WithSuccessfulDownload();
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(5)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.All())
|
||||
.Returns(series);
|
||||
|
||||
Mocker.Resolve<BannerDownloadJob>().Start(_notification, null);
|
||||
VerifyDownloadMock(series.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Start_should_only_attempt_to_download_for_series_with_banner_url()
|
||||
{
|
||||
WithSuccessfulDownload();
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(5)
|
||||
.TheFirst(2)
|
||||
.With(s => s.BannerUrl = null)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.All())
|
||||
.Returns(series);
|
||||
|
||||
Mocker.Resolve<BannerDownloadJob>().Start(_notification, null);
|
||||
VerifyDownloadMock(3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Start_should_download_single_banner_when_seriesId_is_passed_in()
|
||||
{
|
||||
WithSuccessfulDownload();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.Id))
|
||||
.Returns(series);
|
||||
|
||||
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.Id });
|
||||
VerifyDownloadMock(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,6 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)))
|
||||
.Callback(() => series[1].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
|
||||
|
||||
Mocker.GetMock<XemUpdateJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
|
||||
|
||||
@@ -116,9 +113,6 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
|
||||
.Callback(() => series[0].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(series[0].Id)).Returns(series[0]);
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaCoverTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MediaCoverServiceFixture : CoreTest<MediaCoverService>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.SetConstant(new HttpProvider());
|
||||
Mocker.SetConstant(new DiskProvider());
|
||||
Mocker.SetConstant(new EnvironmentProvider());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -763,7 +763,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesType = SeriesType.Daily)
|
||||
.With(s => s.SeriesTypes = SeriesTypes.Daily)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
@@ -792,7 +792,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesType = SeriesType.Daily)
|
||||
.With(s => s.SeriesTypes = SeriesTypes.Daily)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
@@ -821,7 +821,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesType = SeriesType.Daily)
|
||||
.With(s => s.SeriesTypes = SeriesTypes.Daily)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
<Compile Include="JobTests\JobRepositoryFixture.cs" />
|
||||
<Compile Include="JobTests\RenameSeasonJobFixture.cs" />
|
||||
<Compile Include="DecisionEngineTests\LanguageSpecificationFixture.cs" />
|
||||
<Compile Include="MediaCoverTests\MediaCoverServiceFixture.cs" />
|
||||
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\DownloadNzbFixture.cs" />
|
||||
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\QueueFixture.cs" />
|
||||
<Compile Include="ProviderTests\DownloadProviderTests\ContainsRecentEpisode.cs" />
|
||||
@@ -163,13 +164,11 @@
|
||||
<Compile Include="Qualities\QualityFixture.cs" />
|
||||
<Compile Include="EpisodeParseResultTest.cs" />
|
||||
<Compile Include="JobTests\BacklogSearchJobTest.cs" />
|
||||
<Compile Include="JobTests\BannerDownloadJobTest.cs" />
|
||||
<Compile Include="JobTests\RssSyncJobTest.cs" />
|
||||
<Compile Include="JobTests\PostDownloadScanJobFixture.cs" />
|
||||
<Compile Include="JobTests\RecentBacklogSearchJobTest.cs" />
|
||||
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
||||
<Compile Include="Configuration\ConfigCachingFixture.cs" />
|
||||
<Compile Include="ProviderTests\BannerProviderTest.cs" />
|
||||
<Compile Include="DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
|
||||
<Compile Include="DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
|
||||
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpFixture.cs" />
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
using System;
|
||||
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.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.AutoMoq;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class BannerProviderTest : CoreTest
|
||||
{
|
||||
private Series _series;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
WithTempAsAppPath();
|
||||
|
||||
_series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Id = 12345)
|
||||
.Build();
|
||||
|
||||
var path = @"C:\Windows\Temp";
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.CreateDirectory(path));
|
||||
}
|
||||
|
||||
private void WithSuccessfulDownload()
|
||||
{
|
||||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()));
|
||||
}
|
||||
|
||||
private void WithFailedDownload()
|
||||
{
|
||||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()))
|
||||
.Throws(new WebException("Failed to download file (Mocked)"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_should_return_true_when_banner_is_downloaded_successfully()
|
||||
{
|
||||
WithSuccessfulDownload();
|
||||
var result = Mocker.Resolve<BannerProvider>().Download(_series);
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_should_return_false_when_banner_download_fails()
|
||||
{
|
||||
WithFailedDownload();
|
||||
var result = Mocker.Resolve<BannerProvider>().Download(_series);
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delete_should_delete_banner_file_when_it_exists()
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFile(It.IsAny<string>()));
|
||||
|
||||
var result = Mocker.Resolve<BannerProvider>().Delete(1);
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delete_should_return_true_even_when_file_sint_deleted()
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
var result = Mocker.Resolve<BannerProvider>().Delete(1);
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delete_should_return_false_when_file_fails_to_delete()
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFile(It.IsAny<string>()))
|
||||
.Throws(new SystemException("File not found."));
|
||||
|
||||
var result = Mocker.Resolve<BannerProvider>().Delete(1);
|
||||
result.Should().BeFalse();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
{
|
||||
_series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesType = SeriesType.Standard)
|
||||
.With(s => s.SeriesTypes = SeriesTypes.Standard)
|
||||
.Build();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
|
||||
public void WithDailySeries()
|
||||
{
|
||||
_series.SeriesType = SeriesType.Daily;
|
||||
_series.SeriesTypes = SeriesTypes.Daily;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
{
|
||||
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 = SeriesType.Daily },
|
||||
Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesTypes = SeriesTypes.Daily },
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Autofac;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
@@ -17,7 +18,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class TvDbProviderTest : CoreTest
|
||||
{
|
||||
private TvDbProvider tvDbProvider;
|
||||
private TvDbProxy tvDbProxy;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -25,11 +26,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var builder = new ContainerBuilder();
|
||||
|
||||
builder.RegisterType<EnvironmentProvider>();
|
||||
builder.RegisterType<TvDbProvider>();
|
||||
builder.RegisterType<TvDbProxy>();
|
||||
|
||||
var container = builder.Build();
|
||||
|
||||
tvDbProvider = container.Resolve<TvDbProvider>();
|
||||
tvDbProxy = container.Resolve<TvDbProxy>();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
@@ -45,7 +46,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
[TestCase("Franklin & Bash")]
|
||||
public void successful_search(string title)
|
||||
{
|
||||
var result = tvDbProvider.SearchSeries(title);
|
||||
var result = tvDbProxy.SearchSeries(title);
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result[0].Title.Should().Be(title);
|
||||
@@ -56,7 +57,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
public void no_search_result()
|
||||
{
|
||||
//act
|
||||
var result = tvDbProvider.SearchSeries(Guid.NewGuid().ToString());
|
||||
var result = tvDbProxy.SearchSeries(Guid.NewGuid().ToString());
|
||||
|
||||
//assert
|
||||
result.Should().BeEmpty();
|
||||
@@ -67,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
public void none_unique_season_episode_number()
|
||||
{
|
||||
//act
|
||||
var result = tvDbProvider.GetEpisodes(75978);//Family guy
|
||||
var result = tvDbProxy.GetEpisodes(75978);//Family guy
|
||||
|
||||
//Asserts that when episodes are grouped by Season/Episode each group contains maximum of
|
||||
//one item.
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.ReferenceData;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.TvRage;
|
||||
@@ -54,11 +55,11 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
|
||||
.Setup(s => s.GetCleanName(_series.Id))
|
||||
.Returns("");
|
||||
|
||||
Mocker.GetMock<TvRageProvider>()
|
||||
Mocker.GetMock<TvRageProxy>()
|
||||
.Setup(s => s.SearchSeries(_series.Title))
|
||||
.Returns(_searchResults);
|
||||
|
||||
Mocker.GetMock<TvRageProvider>()
|
||||
Mocker.GetMock<TvRageProxy>()
|
||||
.Setup(s => s.GetSeries(_searchResults.First().ShowId))
|
||||
.Returns(_tvRageSeries);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.TvRage;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
@@ -38,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
public void should_be_null_when_no_showinfo_is_returned()
|
||||
{
|
||||
WithEmptyResults();
|
||||
Mocker.Resolve<TvRageProvider>().GetSeries(100).Should().BeNull();
|
||||
Mocker.Resolve<TvRageProxy>().GetSeries(100).Should().BeNull();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
@@ -47,7 +48,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
public void should_return_series_when_showinfo_is_valid()
|
||||
{
|
||||
WithOneResult();
|
||||
var result = Mocker.Resolve<TvRageProvider>().GetSeries(29999);
|
||||
var result = Mocker.Resolve<TvRageProxy>().GetSeries(29999);
|
||||
|
||||
result.ShowId.Should().Be(29999);
|
||||
result.Name.Should().Be("Anger Management");
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
@@ -19,13 +20,13 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
[Test]
|
||||
public void should_return_zero_if_timeZone_is_empty()
|
||||
{
|
||||
Mocker.Resolve<TvRageProvider>().GetUtcOffset("").Should().Be(0);
|
||||
Mocker.Resolve<TvRageProxy>().GetUtcOffset("").Should().Be(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_zero_if_cannot_be_coverted_to_int()
|
||||
{
|
||||
Mocker.Resolve<TvRageProvider>().GetUtcOffset("adfhadfhdjaf").Should().Be(0);
|
||||
Mocker.Resolve<TvRageProxy>().GetUtcOffset("adfhadfhdjaf").Should().Be(0);
|
||||
}
|
||||
|
||||
[TestCase("GMT-5", -5)]
|
||||
@@ -33,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
[TestCase("GMT+8", 8)]
|
||||
public void should_return_offset_when_not_dst(string timezone, int expected)
|
||||
{
|
||||
Mocker.Resolve<TvRageProvider>().GetUtcOffset(timezone).Should().Be(expected);
|
||||
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
|
||||
}
|
||||
|
||||
[TestCase("GMT-5 +DST", -4)]
|
||||
@@ -41,7 +42,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
[TestCase("GMT+8 +DST", 9)]
|
||||
public void should_return_offset_plus_one_when_dst(string timezone, int expected)
|
||||
{
|
||||
Mocker.Resolve<TvRageProvider>().GetUtcOffset(timezone).Should().Be(expected);
|
||||
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
@@ -45,35 +46,35 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
public void should_be_empty_when_no_results_are_found()
|
||||
{
|
||||
WithEmptyResults();
|
||||
Mocker.Resolve<TvRageProvider>().SearchSeries("asdasdasdasdas").Should().BeEmpty();
|
||||
Mocker.Resolve<TvRageProxy>().SearchSeries("asdasdasdasdas").Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_have_more_than_one_when_multiple_results_are_returned()
|
||||
{
|
||||
WithManyResults();
|
||||
Mocker.Resolve<TvRageProvider>().SearchSeries("top+gear").Should().NotBeEmpty();
|
||||
Mocker.Resolve<TvRageProxy>().SearchSeries("top+gear").Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_one_when_only_one_result_is_found()
|
||||
{
|
||||
WithOneResult();
|
||||
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").Should().HaveCount(1);
|
||||
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ended_should_not_have_a_value_when_series_has_not_ended()
|
||||
{
|
||||
WithOneResult();
|
||||
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").First().Ended.HasValue.Should().BeFalse();
|
||||
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").First().Ended.HasValue.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void started_should_match_series()
|
||||
{
|
||||
WithOneResult();
|
||||
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").First().Started.Should().Be(new DateTime(2011, 6, 23));
|
||||
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").First().Started.Should().Be(new DateTime(2011, 6, 23));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user