@ -449,7 +449,7 @@ namespace NzbDrone.Core.Test.Download
}
[Test]
public void should_not_mark_as_ successful_if_no_files_were_impor ted( )
public void should_not_mark_as_ imported_if_all_files_were_rejec ted( )
{
GivenCompletedDownloadClientHistory ( ) ;
@ -464,6 +464,71 @@ namespace NzbDrone.Core.Test.Download
. Setup ( v = > v . ProcessFolder ( It . IsAny < DirectoryInfo > ( ) , It . IsAny < DownloadClientItem > ( ) ) )
. Returns ( new List < ImportResult >
{
new ImportResult (
new ImportDecision ( new LocalEpisode ( ) { Path = @"C:\TestPath\Droned.S01E01.mkv" } , "Rejected!" ) ,
"Test Failure" )
} ) ;
history . First ( ) . Data . Add ( "downloadClient" , "SabnzbdClient" ) ;
history . First ( ) . Data . Add ( "downloadClientId" , _completed . First ( ) . DownloadClientId ) ;
Subject . Execute ( new CheckForFinishedDownloadCommand ( ) ) ;
Mocker . GetMock < IDiskProvider > ( )
. Verify ( c = > c . DeleteFolder ( It . IsAny < string > ( ) , true ) , Times . Never ( ) ) ;
ExceptionVerification . ExpectedErrors ( 1 ) ;
}
[Test]
public void should_not_mark_as_imported_if_all_files_were_skipped ( )
{
GivenCompletedDownloadClientHistory ( ) ;
var history = Builder < History . History > . CreateListOfSize ( 1 )
. Build ( )
. ToList ( ) ;
GivenGrabbedHistory ( history ) ;
GivenNoImportedHistory ( ) ;
Mocker . GetMock < IDownloadedEpisodesImportService > ( )
. Setup ( v = > v . ProcessFolder ( It . IsAny < DirectoryInfo > ( ) , It . IsAny < DownloadClientItem > ( ) ) )
. Returns ( new List < ImportResult >
{
new ImportResult (
new ImportDecision ( new LocalEpisode ( ) { Path = @"C:\TestPath\Droned.S01E01.mkv" } ) ,
"Test Failure" )
} ) ;
history . First ( ) . Data . Add ( "downloadClient" , "SabnzbdClient" ) ;
history . First ( ) . Data . Add ( "downloadClientId" , _completed . First ( ) . DownloadClientId ) ;
Subject . Execute ( new CheckForFinishedDownloadCommand ( ) ) ;
Mocker . GetMock < IDiskProvider > ( )
. Verify ( c = > c . DeleteFolder ( It . IsAny < string > ( ) , true ) , Times . Never ( ) ) ;
ExceptionVerification . ExpectedErrors ( 1 ) ;
}
[Test]
public void should_not_mark_as_imported_if_some_files_were_skipped ( )
{
GivenCompletedDownloadClientHistory ( ) ;
var history = Builder < History . History > . CreateListOfSize ( 1 )
. Build ( )
. ToList ( ) ;
GivenGrabbedHistory ( history ) ;
GivenNoImportedHistory ( ) ;
Mocker . GetMock < IDownloadedEpisodesImportService > ( )
. Setup ( v = > v . ProcessFolder ( It . IsAny < DirectoryInfo > ( ) , It . IsAny < DownloadClientItem > ( ) ) )
. Returns ( new List < ImportResult >
{
new ImportResult ( new ImportDecision ( new LocalEpisode ( ) { Path = @"C:\TestPath\Droned.S01E01.mkv" } ) ) ,
new ImportResult (
new ImportDecision ( new LocalEpisode ( ) { Path = @"C:\TestPath\Droned.S01E01.mkv" } ) ,
"Test Failure" )