Fixed errors in MatchesFolderSpecification and tests.

This commit is contained in:
Taloth Saldono 2018-04-14 22:21:48 +02:00
parent c677736a8f
commit fd1064cb69
2 changed files with 14 additions and 4 deletions

View File

@ -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<ParsedEpisodeInfo>.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<ParsedEpisodeInfo>.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]

View File

@ -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)
{