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

View File

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