only publish import event if an episode is actually imported.
This commit is contained in:
parent
baab8cd838
commit
487ad01a0e
|
@ -6,9 +6,9 @@ using NUnit.Framework;
|
|||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
||||
|
@ -95,6 +95,18 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(c => c.MoveEpisodeFile(_fakeEpisodeFile, true), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_trigger_import_event_on_import()
|
||||
{
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.ImportFile(It.IsAny<Series>(), It.IsAny<string>()))
|
||||
.Returns(_fakeEpisodeFile);
|
||||
|
||||
Subject.ProcessDownloadedEpisodesFolder();
|
||||
|
||||
VerifyEventPublished<EpisodeImportedEvent>();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_attempt_move_if_nothing_is_imported()
|
||||
{
|
||||
|
@ -106,6 +118,19 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(c => c.MoveEpisodeFile(It.IsAny<EpisodeFile>(), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_not_publish_import_event_if_nothing_is_imported()
|
||||
{
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.ImportFile(It.IsAny<Series>(), It.IsAny<string>()))
|
||||
.Returns<EpisodeFile>(null);
|
||||
|
||||
Subject.ProcessDownloadedEpisodesFolder();
|
||||
|
||||
|
||||
VerifyEventNotPublished<EpisodeImportedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_if_folder_is_in_use_by_another_process()
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||
}
|
||||
}
|
||||
|
||||
public void ProcessVideoFile(string videoFile, Series series)
|
||||
private void ProcessVideoFile(string videoFile, Series series)
|
||||
{
|
||||
var lastWrite = _diskProvider.GetLastFileWrite(videoFile);
|
||||
|
||||
|
@ -138,9 +138,8 @@ namespace NzbDrone.Core.MediaFiles
|
|||
if (episodeFile != null)
|
||||
{
|
||||
_episodeFileMover.MoveEpisodeFile(episodeFile, true);
|
||||
_messageAggregator.PublishEvent(new EpisodeImportedEvent(episodeFile));
|
||||
}
|
||||
|
||||
_messageAggregator.PublishEvent(new EpisodeImportedEvent(episodeFile));
|
||||
}
|
||||
|
||||
public void Execute(DownloadedEpisodesScanCommand message)
|
||||
|
|
Loading…
Reference in New Issue