|
|
|
@ -14,6 +14,7 @@ using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using NzbDrone.Core.Download;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
{
|
|
|
|
@ -44,13 +45,13 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
_fail2 = new Mock<IImportDecisionEngineSpecification>();
|
|
|
|
|
_fail3 = new Mock<IImportDecisionEngineSpecification>();
|
|
|
|
|
|
|
|
|
|
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
|
|
|
|
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
|
|
|
|
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
|
|
|
|
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
|
|
|
|
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
|
|
|
|
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
|
|
|
|
|
|
|
|
|
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail1"));
|
|
|
|
|
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail2"));
|
|
|
|
|
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail3"));
|
|
|
|
|
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail1"));
|
|
|
|
|
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail2"));
|
|
|
|
|
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail3"));
|
|
|
|
|
|
|
|
|
|
_series = Builder<Series>.CreateNew()
|
|
|
|
|
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
|
|
|
@ -92,14 +93,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
{
|
|
|
|
|
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, new Series(), null, false);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, new Series(), new DownloadClientItem(), null, false);
|
|
|
|
|
|
|
|
|
|
_fail1.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_fail2.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_fail3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_pass1.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_pass2.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
|
|
|
|
_fail1.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
_fail2.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
_fail3.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
_pass1.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
_pass2.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -184,7 +185,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
GivenSpecifications(_pass1, _pass2, _pass3);
|
|
|
|
|
var expectedQuality = QualityParser.ParseQuality(_videoFiles.Single());
|
|
|
|
|
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.SDTV)}, true);
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.SDTV)}, true);
|
|
|
|
|
|
|
|
|
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
|
|
|
|
}
|
|
|
|
@ -201,7 +202,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var expectedQuality = new QualityModel(Quality.SDTV);
|
|
|
|
|
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
|
|
|
|
|
|
|
|
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
|
|
|
|
}
|
|
|
|
@ -217,7 +218,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var expectedQuality = new QualityModel(Quality.Bluray720p);
|
|
|
|
|
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
|
|
|
|
|
|
|
|
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
|
|
|
|
}
|
|
|
|
@ -264,7 +265,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01");
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IParsingService>()
|
|
|
|
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(3));
|
|
|
|
@ -287,7 +288,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IParsingService>()
|
|
|
|
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(2));
|
|
|
|
@ -309,7 +310,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IParsingService>()
|
|
|
|
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(1));
|
|
|
|
@ -336,7 +337,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IParsingService>()
|
|
|
|
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(2));
|
|
|
|
@ -358,7 +359,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01.720p.HDTV-LOL");
|
|
|
|
|
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
|
|
|
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IParsingService>()
|
|
|
|
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(1));
|
|
|
|
@ -380,7 +381,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|
|
|
|
|
|
|
|
|
var folderQuality = new QualityModel(Quality.Unknown);
|
|
|
|
|
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = folderQuality}, true);
|
|
|
|
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = folderQuality}, true);
|
|
|
|
|
|
|
|
|
|
result.Single().LocalEpisode.Quality.Should().Be(_quality);
|
|
|
|
|
}
|
|
|
|
|