1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed missing existingfile flag.

This commit is contained in:
Taloth Saldono 2018-04-15 16:24:32 +02:00
parent 62f7e90748
commit 5b627a8bc2
2 changed files with 8 additions and 6 deletions

View File

@ -54,6 +54,7 @@ public void Setup()
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail3"));
_series = Builder<Series>.CreateNew()
.With(e => e.Path = @"C:\Test\Series".AsOsAgnostic())
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build();
@ -101,7 +102,7 @@ public void should_call_all_specifications()
GivenAugmentationSuccess();
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
Subject.GetImportDecisions(_videoFiles, new Series(), downloadClientItem, null, false);
Subject.GetImportDecisions(_videoFiles, _series, downloadClientItem, null, false);
_fail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), downloadClientItem), Times.Once());
_fail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), downloadClientItem), Times.Once());
@ -116,7 +117,7 @@ public void should_return_rejected_if_single_specs_fail()
{
GivenSpecifications(_fail1);
var result = Subject.GetImportDecisions(_videoFiles, new Series());
var result = Subject.GetImportDecisions(_videoFiles, _series);
result.Single().Approved.Should().BeFalse();
}
@ -126,7 +127,7 @@ public void should_return_rejected_if_one_of_specs_fail()
{
GivenSpecifications(_pass1, _fail1, _pass2, _pass3);
var result = Subject.GetImportDecisions(_videoFiles, new Series());
var result = Subject.GetImportDecisions(_videoFiles, _series);
result.Single().Approved.Should().BeFalse();
}
@ -137,7 +138,7 @@ public void should_return_approved_if_all_specs_pass()
GivenAugmentationSuccess();
GivenSpecifications(_pass1, _pass2, _pass3);
var result = Subject.GetImportDecisions(_videoFiles, new Series());
var result = Subject.GetImportDecisions(_videoFiles, _series);
result.Single().Approved.Should().BeTrue();
}
@ -148,7 +149,7 @@ public void should_have_same_number_of_rejections_as_specs_that_failed()
GivenAugmentationSuccess();
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
var result = Subject.GetImportDecisions(_videoFiles, new Series());
var result = Subject.GetImportDecisions(_videoFiles, _series);
result.Single().Rejections.Should().HaveCount(3);
}

View File

@ -73,7 +73,8 @@ public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series s
DownloadClientEpisodeInfo = downloadClientItemInfo,
FolderEpisodeInfo = folderInfo,
Path = file,
SceneSource = sceneSource
SceneSource = sceneSource,
ExistingFile = series.Path.IsParentPath(file)
};
decisions.AddIfNotNull(GetDecision(localEpisode, downloadClientItem, nonSampleVideoFileCount > 1));