From 0e6f858e657650665dd522f6dd765b6b40e75d3e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 9 May 2023 10:03:53 -0700 Subject: [PATCH] Fixed tests --- .../MatchesGrabSpecificationFixture.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesGrabSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesGrabSpecificationFixture.cs index a874b8fe2..c00feadfe 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesGrabSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesGrabSpecificationFixture.cs @@ -4,7 +4,9 @@ using FizzWare.NBuilder; using FluentAssertions; using Moq; using NUnit.Framework; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Download; +using NzbDrone.Core.History; using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; @@ -48,8 +50,22 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications private void GivenHistoryForEpisodes(params Episode[] episodes) { - _localEpisode.Release = new GrabbedReleaseInfo(); - _localEpisode.Release.EpisodeIds = episodes.Select(e => e.Id).ToList(); + if (episodes.Empty()) + { + return; + } + + var grabbedHistories = Builder.CreateListOfSize(episodes.Length) + .All() + .With(h => h.EventType == EpisodeHistoryEventType.Grabbed) + .BuildList(); + + for (var i = 0; i < grabbedHistories.Count; i++) + { + grabbedHistories[i].EpisodeId = episodes[i].Id; + } + + _localEpisode.Release = new GrabbedReleaseInfo(grabbedHistories); } [Test]