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.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 @@ public void Setup() .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 @@ private void VerifyNoFailedDownloads() 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 @@ public void should_not_process_if_no_failed_items_in_download_client_history() [Test] public void should_not_process_if_matching_history_is_not_found() { - GivenNoRecentHistory(); + GivenNoGrabbedHistory(); GivenFailedDownloadClientHistory(); Subject.Execute(new FailedDownloadCommand()); @@ -141,7 +135,7 @@ public void should_not_process_if_already_added_to_history_as_failed() .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenFailedHistory(history); history.First().Data.Add("downloadClient", "SabnzbdClient"); @@ -161,7 +155,7 @@ public void should_process_if_not_already_in_failed_history() .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenNoFailedHistory(); history.First().Data.Add("downloadClient", "SabnzbdClient"); @@ -173,7 +167,7 @@ public void should_process_if_not_already_in_failed_history() } [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 @@ public void should_process_for_each_failed_episode() .Build() .ToList(); - GivenRecentHistory(history); + GivenGrabbedHistory(history); GivenNoFailedHistory(); history.ForEach(h =>