mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
Episode files are moved to final folder without renaming before deletion and final renaming
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Marr.Data;
|
||||
using Moq;
|
||||
@@ -122,7 +123,6 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(It.IsAny<EpisodeFile>(), true), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_delete_existing_file_fromdb_if_file_doesnt_exist()
|
||||
{
|
||||
@@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_try_to_recyclebin_existing_file_fromdb_if_file_doesnt_exist()
|
||||
public void should_not_try_to_recyclebin_existing_file_if_file_doesnt_exist()
|
||||
{
|
||||
GivenSingleEpisodeWithSingleEpisodeFile();
|
||||
|
||||
@@ -150,5 +150,30 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_delete_file_if_pre_move_fails()
|
||||
{
|
||||
GivenSingleEpisodeWithSingleEpisodeFile();
|
||||
|
||||
Mocker.GetMock<IMoveEpisodeFiles>()
|
||||
.Setup(s => s.PreMoveEpisodeFile(It.IsAny<EpisodeFile>(), It.IsAny<LocalEpisode>()))
|
||||
.Throws<InvalidOperationException>();
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Subject.UpgradeEpisodeFile(_episodeFile, _localEpisode));
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_move_after_premove()
|
||||
{
|
||||
GivenSingleEpisodeWithSingleEpisodeFile();
|
||||
|
||||
Subject.UpgradeEpisodeFile(_episodeFile, _localEpisode);
|
||||
|
||||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(v => v.PreMoveEpisodeFile(It.IsAny<EpisodeFile>(), It.IsAny<LocalEpisode>()), Times.Once());
|
||||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(v => v.MoveEpisodeFile(It.IsAny<EpisodeFile>(), It.IsAny<LocalEpisode>()), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user