diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs index 00d3dae1a..c2b6bb27d 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs @@ -20,7 +20,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications .With(l => l.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic()) .With(l => l.FileEpisodeInfo = Builder.CreateNew() - .With(p => p.EpisodeNumbers = new[] {5}) + .With(p => p.EpisodeNumbers = new[] { 5 }) + .With(p => p.SeasonNumber == 1) + .With(p => p.FullSeason = false) + .Build()) + .With(l => l.FolderEpisodeInfo = + Builder.CreateNew() + .With(p => p.EpisodeNumbers = new[] { 1 }) + .With(p => p.SeasonNumber == 1) .With(p => p.FullSeason = false) .Build()) .Build(); @@ -38,6 +45,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications public void should_be_accepted_if_folder_name_is_not_parseable() { _localEpisode.Path = @"C:\Test\Unsorted\Series.Title\S01E01.mkv".AsOsAgnostic(); + _localEpisode.FolderEpisodeInfo = null; Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); } @@ -46,6 +54,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications public void should_should_be_accepted_for_full_season() { _localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01\S01E01.mkv".AsOsAgnostic(); + _localEpisode.FolderEpisodeInfo.EpisodeNumbers = new int[0]; + _localEpisode.FolderEpisodeInfo.FullSeason = true; Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); } @@ -65,14 +75,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications _localEpisode.FileEpisodeInfo.EpisodeNumbers = new[] { 1 }; _localEpisode.FolderEpisodeInfo.EpisodeNumbers = new[] { 1 }; _localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01E02.720p.HDTV-Sonarr\S01E01.mkv".AsOsAgnostic(); - Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); } [Test] public void should_be_rejected_if_file_and_folder_do_not_have_same_episode() { _localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic(); - Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse(); } [Test] diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs index c9e907a96..ba3a203a0 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs @@ -32,7 +32,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications return Decision.Accept(); } - var folderInfo = localEpisode.FileEpisodeInfo; + var folderInfo = localEpisode.FolderEpisodeInfo; if (folderInfo != null && folderInfo.IsPossibleSceneSeasonSpecial) {