1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-10 04:52:42 +01:00

Fixed broken tests.

This commit is contained in:
Mark McDowall 2012-01-14 18:05:05 -08:00
parent b5ddb79c7b
commit 624b6e5acb
2 changed files with 20 additions and 0 deletions

View File

@ -7,6 +7,7 @@
using NzbDrone.Core.Jobs; using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common.AutoMoq;
@ -16,6 +17,11 @@ namespace NzbDrone.Core.Test.JobTests
[TestFixture] [TestFixture]
public class BacklogSearchJobTest : CoreTest public class BacklogSearchJobTest : CoreTest
{ {
private void WithEnableBacklogSearching()
{
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
}
[Test] [Test]
public void no_missing_epsiodes_should_not_trigger_any_search() public void no_missing_epsiodes_should_not_trigger_any_search()
{ {
@ -25,6 +31,7 @@ public void no_missing_epsiodes_should_not_trigger_any_search()
var episodes = new List<Episode>(); var episodes = new List<Episode>();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
@ -49,6 +56,7 @@ public void individual_missing_episode()
var episodes = Builder<Episode>.CreateListOfSize(1).Build(); var episodes = Builder<Episode>.CreateListOfSize(1).Build();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
@ -76,6 +84,7 @@ public void individual_missing_episodes_only()
var episodes = Builder<Episode>.CreateListOfSize(5).Build(); var episodes = Builder<Episode>.CreateListOfSize(5).Build();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
@ -107,6 +116,7 @@ public void series_season_missing_episodes_only_mismatch_count()
.Build(); .Build();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
@ -141,6 +151,7 @@ public void series_season_missing_episodes_only()
.Build(); .Build();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
@ -175,6 +186,7 @@ public void multiple_missing_episodes()
.Build(); .Build();
WithStrictMocker(); WithStrictMocker();
WithEnableBacklogSearching();
Mocker.GetMock<EpisodeProvider>() Mocker.GetMock<EpisodeProvider>()
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);

View File

@ -8,6 +8,7 @@
using NzbDrone.Core.Jobs; using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common.AutoMoq;
@ -17,6 +18,11 @@ namespace NzbDrone.Core.Test.JobTests
[TestFixture] [TestFixture]
public class RecentBacklogSearchJobTest : CoreTest public class RecentBacklogSearchJobTest : CoreTest
{ {
private void WithEnableBacklogSearching()
{
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
}
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
@ -43,6 +49,8 @@ public void no_missing_epsiodes_should_not_trigger_any_search()
[Test] [Test]
public void should_only_process_missing_episodes_from_the_last_30_days() public void should_only_process_missing_episodes_from_the_last_30_days()
{ {
WithEnableBacklogSearching();
//Setup //Setup
var episodes = Builder<Episode>.CreateListOfSize(50) var episodes = Builder<Episode>.CreateListOfSize(50)
.TheFirst(5) .TheFirst(5)