From 5150f9bd919d6c7b9b133444c7712c9cabeec5e8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 23 Oct 2013 22:24:26 -0700 Subject: [PATCH] Fixed broken tests --- .../Download/FailedDownloadServiceFixture.cs | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceFixture.cs index 478515d6a..969b0443f 100644 --- a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceFixture.cs @@ -8,24 +8,18 @@ using NzbDrone.Core.Download; using NzbDrone.Core.History; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Test.Framework; -using NzbDrone.Core.Tv; namespace NzbDrone.Core.Test.Download { [TestFixture] public class FailedDownloadServiceFixture : CoreTest { - private Series _series; - private Episode _episode; private List _completed; private List _failed; [SetUp] public void Setup() { - _series = Builder.CreateNew().Build(); - _episode = Builder.CreateNew().Build(); - _completed = Builder.CreateListOfSize(5) .All() .With(h => h.Status = HistoryStatus.Completed) @@ -42,17 +36,17 @@ namespace NzbDrone.Core.Test.Download .Setup(c => c.GetDownloadClient()).Returns(Mocker.GetMock().Object); } - private void GivenNoRecentHistory() + private void GivenNoGrabbedHistory() { Mocker.GetMock() - .Setup(s => s.BetweenDates(It.IsAny(), It.IsAny(), HistoryEventType.Grabbed)) + .Setup(s => s.Grabbed()) .Returns(new List()); } - private void GivenRecentHistory(List history) + private void GivenGrabbedHistory(List history) { Mocker.GetMock() - .Setup(s => s.BetweenDates(It.IsAny(), It.IsAny(), HistoryEventType.Grabbed)) + .Setup(s => s.Grabbed()) .Returns(history); } @@ -86,7 +80,7 @@ namespace NzbDrone.Core.Test.Download private void VerifyFailedDownloads(int count = 1) { Mocker.GetMock() - .Verify(v => v.PublishEvent(It.IsAny()), Times.Exactly(count)); + .Verify(v => v.PublishEvent(It.Is(d => d.EpisodeIds.Count == count)), Times.Once()); } [Test] @@ -124,7 +118,7 @@ namespace NzbDrone.Core.Test.Download [Test] public void should_not_process_if_matching_history_is_not_found() { - GivenNoRecentHistory(); + GivenNoGrabbedHistory(); GivenFailedDownloadClientHistory(); Subject.Execute(new FailedDownloadCommand()); @@ -141,7 +135,7 @@ namespace NzbDrone.Core.Test.Download .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenFailedHistory(history); history.First().Data.Add("downloadClient", "SabnzbdClient"); @@ -161,7 +155,7 @@ namespace NzbDrone.Core.Test.Download .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenNoFailedHistory(); history.First().Data.Add("downloadClient", "SabnzbdClient"); @@ -173,7 +167,7 @@ namespace NzbDrone.Core.Test.Download } [Test] - public void should_process_for_each_failed_episode() + public void should_have_multiple_episode_ids_when_multi_episode_release_fails() { GivenFailedDownloadClientHistory(); @@ -181,7 +175,7 @@ namespace NzbDrone.Core.Test.Download .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenNoFailedHistory(); history.ForEach(h =>