From e882d0f3859ced16351e70dab1e2418c2291dd7a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 9 May 2023 13:11:12 -0700 Subject: [PATCH] Fixed CompletedDownloadService.Process tests --- .../ProcessFixture.cs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs index b8025b6c1..0eac84893 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs @@ -1,16 +1,14 @@ -using System.Collections.Generic; +using System.Collections.Generic; using FizzWare.NBuilder; using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common.Disk; -using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Download; using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.History; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles.EpisodeImport; -using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; @@ -54,8 +52,8 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests .Returns((DownloadClientItem item, DownloadClientItem previous) => item); Mocker.GetMock() - .Setup(s => s.MostRecentForDownloadId(_trackedDownload.DownloadItem.DownloadId)) - .Returns(new EpisodeHistory()); + .Setup(s => s.FindByDownloadId(_trackedDownload.DownloadItem.DownloadId)) + .Returns(new List()); Mocker.GetMock() .Setup(s => s.GetSeries("Drone.S01E01.HDTV")) @@ -74,8 +72,8 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests private void GivenNoGrabbedHistory() { Mocker.GetMock() - .Setup(s => s.MostRecentForDownloadId(_trackedDownload.DownloadItem.DownloadId)) - .Returns((EpisodeHistory)null); + .Setup(s => s.FindByDownloadId(_trackedDownload.DownloadItem.DownloadId)) + .Returns(new List()); } private void GivenSeriesMatch() @@ -90,8 +88,11 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests _trackedDownload.DownloadItem.DownloadId = "1234"; _trackedDownload.DownloadItem.Title = "Droned Pilot"; // Set a badly named download Mocker.GetMock() - .Setup(s => s.MostRecentForDownloadId(It.Is(i => i == "1234"))) - .Returns(new EpisodeHistory() { SourceTitle = "Droned S01E01" }); + .Setup(s => s.FindByDownloadId(It.Is(i => i == "1234"))) + .Returns(new List + { + new EpisodeHistory() { SourceTitle = "Droned S01E01", EventType = EpisodeHistoryEventType.Grabbed } + }); Mocker.GetMock() .Setup(s => s.GetSeries(It.IsAny())) @@ -161,9 +162,6 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests new ImportResult(new ImportDecision(new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv" })) }); - Mocker.GetMock() - .Setup(s => s.MostRecentForDownloadId(It.Is(i => i == "1234"))); - Subject.Check(_trackedDownload); AssertNotReadyToImport();