@ -20,16 +20,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
{
protected DownloadStationSettings _settings ;
protected DownloadStationT orrent _queued ;
protected DownloadStationT orrent _downloading ;
protected DownloadStationT orrent _failed ;
protected DownloadStationT orrent _completed ;
protected DownloadStationT orrent _seeding ;
protected DownloadStationT orrent _magnet ;
protected DownloadStationT orrent _singleFile ;
protected DownloadStationT orrent _multipleFiles ;
protected DownloadStationT orrent _singleFileCompleted ;
protected DownloadStationT orrent _multipleFilesCompleted ;
protected DownloadStationT ask _queued ;
protected DownloadStationT ask _downloading ;
protected DownloadStationT ask _failed ;
protected DownloadStationT ask _completed ;
protected DownloadStationT ask _seeding ;
protected DownloadStationT ask _magnet ;
protected DownloadStationT ask _singleFile ;
protected DownloadStationT ask _multipleFiles ;
protected DownloadStationT ask _singleFileCompleted ;
protected DownloadStationT ask _multipleFilesCompleted ;
protected string _serialNumber = "SERIALNUMBER" ;
protected string _category = "sonarr" ;
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Subject . Definition = new DownloadClientDefinition ( ) ;
Subject . Definition . Settings = _settings ;
_queued = new DownloadStationT orrent ( )
_queued = new DownloadStationT ask ( )
{
Id = "id1" ,
Size = 1000 ,
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_completed = new DownloadStationT orrent ( )
_completed = new DownloadStationT ask ( )
{
Id = "id2" ,
Size = 1000 ,
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_seeding = new DownloadStationT orrent ( )
_seeding = new DownloadStationT ask ( )
{
Id = "id2" ,
Size = 1000 ,
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_downloading = new DownloadStationT orrent ( )
_downloading = new DownloadStationT ask ( )
{
Id = "id3" ,
Size = 1000 ,
@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_failed = new DownloadStationT orrent ( )
_failed = new DownloadStationT ask ( )
{
Id = "id4" ,
Size = 1000 ,
@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_singleFile = new DownloadStationT orrent ( )
_singleFile = new DownloadStationT ask ( )
{
Id = "id5" ,
Size = 1000 ,
@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "a.mkv" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -193,7 +193,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_multipleFiles = new DownloadStationT orrent ( )
_multipleFiles = new DownloadStationT ask ( )
{
Id = "id6" ,
Size = 1000 ,
@ -201,7 +201,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -216,7 +216,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_singleFileCompleted = new DownloadStationT orrent ( )
_singleFileCompleted = new DownloadStationT ask ( )
{
Id = "id6" ,
Size = 1000 ,
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "a.mkv" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -239,7 +239,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
} ;
_multipleFilesCompleted = new DownloadStationT orrent ( )
_multipleFilesCompleted = new DownloadStationT ask ( )
{
Id = "id6" ,
Size = 1000 ,
@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Type = DownloadStationTaskType . BT ,
Username = "admin" ,
Title = "title" ,
Additional = new DownloadStationT orrent Additional
Additional = new DownloadStationT ask Additional
{
Detail = new Dictionary < string , string >
{
@ -304,21 +304,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
_settings . TvDirectory = _tvDirectory ;
}
protected virtual void GivenTorrents ( List < DownloadStationT orrent > torrents )
protected virtual void GivenTorrents ( List < DownloadStationT ask > torrents )
{
if ( torrents = = null )
{
torrents = new List < DownloadStationT orrent > ( ) ;
torrents = new List < DownloadStationT ask > ( ) ;
}
Mocker . GetMock < IDownloadStationProxy > ( )
. Setup ( s = > s . GetT orrents( It . IsAny < DownloadStationSettings > ( ) ) )
. Setup ( s = > s . GetT asks( DownloadStationTaskType . BT , It . IsAny < DownloadStationSettings > ( ) ) )
. Returns ( torrents ) ;
}
protected void PrepareClientToReturnQueuedItem ( )
{
GivenTorrents ( new List < DownloadStationT orrent >
GivenTorrents ( new List < DownloadStationT ask >
{
_queued
} ) ;
@ -331,11 +331,11 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
. Returns < HttpRequest > ( r = > new HttpResponse ( r , new HttpHeader ( ) , new byte [ 1000 ] ) ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Setup ( s = > s . AddT orrent FromUrl( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < DownloadStationSettings > ( ) ) )
. Setup ( s = > s . AddT ask FromUrl( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < DownloadStationSettings > ( ) ) )
. Callback ( PrepareClientToReturnQueuedItem ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Setup ( s = > s . AddT orrent FromData( It . IsAny < byte [ ] > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < DownloadStationSettings > ( ) ) )
. Setup ( s = > s . AddT ask FromData( It . IsAny < byte [ ] > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < DownloadStationSettings > ( ) ) )
. Callback ( PrepareClientToReturnQueuedItem ) ;
}
@ -350,10 +350,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
protected int GivenAllKindOfTasks ( )
{
var tasks = new List < DownloadStationT orrent > ( ) { _queued , _completed , _failed , _downloading , _seeding } ;
var tasks = new List < DownloadStationT ask > ( ) { _queued , _completed , _failed , _downloading , _seeding } ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Setup ( d = > d . GetT orrents( _settings ) )
. Setup ( d = > d . GetT asks( DownloadStationTaskType . BT , _settings ) )
. Returns ( tasks ) ;
return tasks . Count ;
@ -373,7 +373,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
id . Should ( ) . NotBeNullOrEmpty ( ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Verify ( v = > v . AddT orrent FromUrl( It . IsAny < string > ( ) , _tvDirectory , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
. Verify ( v = > v . AddT ask FromUrl( It . IsAny < string > ( ) , _tvDirectory , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
}
[Test]
@ -390,7 +390,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
id . Should ( ) . NotBeNullOrEmpty ( ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Verify ( v = > v . AddT orrent FromUrl( It . IsAny < string > ( ) , $"{_defaultDestination}/{_category}" , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
. Verify ( v = > v . AddT ask FromUrl( It . IsAny < string > ( ) , $"{_defaultDestination}/{_category}" , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
}
[Test]
@ -406,7 +406,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
id . Should ( ) . NotBeNullOrEmpty ( ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Verify ( v = > v . AddT orrent FromUrl( It . IsAny < string > ( ) , null , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
. Verify ( v = > v . AddT ask FromUrl( It . IsAny < string > ( ) , null , It . IsAny < DownloadStationSettings > ( ) ) , Times . Once ( ) ) ;
}
[Test]
@ -416,7 +416,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent > { _completed } ) ;
GivenTorrents ( new List < DownloadStationT ask > { _completed } ) ;
Subject . GetItems ( ) . Should ( ) . BeEmpty ( ) ;
}
@ -450,7 +450,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void Download_should_throw_and_not_add_t orrent _if_cannot_get_serial_number( )
public void Download_should_throw_and_not_add_t ask _if_cannot_get_serial_number( )
{
var remoteEpisode = CreateRemoteEpisode ( ) ;
@ -461,16 +461,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
Assert . Throws ( Is . InstanceOf < Exception > ( ) , ( ) = > Subject . Download ( remoteEpisode ) ) ;
Mocker . GetMock < IDownloadStationProxy > ( )
. Verify ( v = > v . AddT orrent FromUrl( It . IsAny < string > ( ) , null , _settings ) , Times . Never ( ) ) ;
. Verify ( v = > v . AddT ask FromUrl( It . IsAny < string > ( ) , null , _settings ) , Times . Never ( ) ) ;
}
[Test]
public void GetItems_should_set_outputPath_to_base_folder_when_single_file_non_finished_t orrent ( )
public void GetItems_should_set_outputPath_to_base_folder_when_single_file_non_finished_t asks ( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _singleFile } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _singleFile } ) ;
var items = Subject . GetItems ( ) ;
@ -479,12 +479,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void GetItems_should_set_outputPath_to_torrent_folder_when_multiple_files_non_finished_t orrent ( )
public void GetItems_should_set_outputPath_to_torrent_folder_when_multiple_files_non_finished_t asks ( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _multipleFiles } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _multipleFiles } ) ;
var items = Subject . GetItems ( ) ;
@ -493,12 +493,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void GetItems_should_set_outputPath_to_base_folder_when_single_file_finished_t orrent ( )
public void GetItems_should_set_outputPath_to_base_folder_when_single_file_finished_t asks ( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _singleFileCompleted } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _singleFileCompleted } ) ;
var items = Subject . GetItems ( ) ;
@ -507,12 +507,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void GetItems_should_set_outputPath_to_torrent_folder_when_multiple_files_finished_t orrent ( )
public void GetItems_should_set_outputPath_to_torrent_folder_when_multiple_files_finished_t asks ( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _multipleFilesCompleted } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _multipleFilesCompleted } ) ;
var items = Subject . GetItems ( ) ;
@ -521,12 +521,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void GetItems_should_not_map_outputpath_for_queued_or_downloading_t orrent s( )
public void GetItems_should_not_map_outputpath_for_queued_or_downloading_t ask s( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent >
GivenTorrents ( new List < DownloadStationT ask >
{
_queued , _downloading
} ) ;
@ -538,12 +538,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
}
[Test]
public void GetItems_should_map_outputpath_for_completed_or_failed_t orrent s( )
public void GetItems_should_map_outputpath_for_completed_or_failed_t ask s( )
{
GivenSerialNumber ( ) ;
GivenSharedFolder ( ) ;
GivenTorrents ( new List < DownloadStationT orrent >
GivenTorrents ( new List < DownloadStationT ask >
{
_completed , _failed , _seeding
} ) ;
@ -565,7 +565,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
_queued . Status = apiStatus ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _queued } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _queued } ) ;
var items = Subject . GetItems ( ) ;
@ -589,7 +589,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
_queued . Status = apiStatus ;
GivenTorrents ( new List < DownloadStationT orrent > ( ) { _queued } ) ;
GivenTorrents ( new List < DownloadStationT ask > ( ) { _queued } ) ;
var items = Subject . GetItems ( ) ;
items . Should ( ) . HaveCount ( 1 ) ;