@ -10,7 +10,7 @@ using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration ;
using NzbDrone.Core.Configuration ;
using NzbDrone.Core.RootFolders ;
using NzbDrone.Core.RootFolders ;
using NzbDrone.Core.Test.Framework ;
using NzbDrone.Core.Test.Framework ;
using NzbDrone.Core. Tv ;
using NzbDrone.Core. Music ;
using NzbDrone.Test.Common ;
using NzbDrone.Test.Common ;
namespace NzbDrone.Core.Test.RootFolderTests
namespace NzbDrone.Core.Test.RootFolderTests
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
. Returns ( false ) ;
. Returns ( false ) ;
}
}
[TestCase("D:\\ TV Shows \\")]
[TestCase("D:\\ Music \\")]
[TestCase("//server//folder")]
[TestCase("//server//folder")]
public void should_be_able_to_add_root_dir ( string path )
public void should_be_able_to_add_root_dir ( string path )
{
{
@ -81,9 +81,9 @@ namespace NzbDrone.Core.Test.RootFolderTests
[Test]
[Test]
public void adding_duplicated_root_folder_should_throw ( )
public void adding_duplicated_root_folder_should_throw ( )
{
{
Mocker . GetMock < IRootFolderRepository > ( ) . Setup ( c = > c . All ( ) ) . Returns ( new List < RootFolder > { new RootFolder { Path = "C:\\ TV ". AsOsAgnostic ( ) } } ) ;
Mocker . GetMock < IRootFolderRepository > ( ) . Setup ( c = > c . All ( ) ) . Returns ( new List < RootFolder > { new RootFolder { Path = "C:\\ Music ". AsOsAgnostic ( ) } } ) ;
Assert . Throws < InvalidOperationException > ( ( ) = > Subject . Add ( new RootFolder { Path = @"C:\ TV ". AsOsAgnostic ( ) } ) ) ;
Assert . Throws < InvalidOperationException > ( ( ) = > Subject . Add ( new RootFolder { Path = @"C:\ Music ". AsOsAgnostic ( ) } ) ) ;
}
}
[Test]
[Test]
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
. Setup ( m = > m . FolderWritable ( It . IsAny < string > ( ) ) )
. Setup ( m = > m . FolderWritable ( It . IsAny < string > ( ) ) )
. Returns ( false ) ;
. Returns ( false ) ;
Assert . Throws < UnauthorizedAccessException > ( ( ) = > Subject . Add ( new RootFolder { Path = @"C:\ TV ". AsOsAgnostic ( ) } ) ) ;
Assert . Throws < UnauthorizedAccessException > ( ( ) = > Subject . Add ( new RootFolder { Path = @"C:\ Music ". AsOsAgnostic ( ) } ) ) ;
}
}
[TestCase("$recycle.bin")]
[TestCase("$recycle.bin")]
@ -107,16 +107,16 @@ namespace NzbDrone.Core.Test.RootFolderTests
[TestCase(".grab")]
[TestCase(".grab")]
public void should_get_root_folder_with_subfolders_excluding_special_sub_folders ( string subFolder )
public void should_get_root_folder_with_subfolders_excluding_special_sub_folders ( string subFolder )
{
{
var rootFolderPath = @"C:\Test\ TV ". AsOsAgnostic ( ) ;
var rootFolderPath = @"C:\Test\ Music ". AsOsAgnostic ( ) ;
var rootFolder = Builder < RootFolder > . CreateNew ( )
var rootFolder = Builder < RootFolder > . CreateNew ( )
. With ( r = > r . Path = rootFolderPath )
. With ( r = > r . Path = rootFolderPath )
. Build ( ) ;
. Build ( ) ;
var subFolders = new [ ]
var subFolders = new [ ]
{
{
" Series 1",
" Artist 1",
" Series 2",
" Artist 2",
" Series 3",
" Artist 3",
subFolder
subFolder
} ;
} ;
@ -126,9 +126,9 @@ namespace NzbDrone.Core.Test.RootFolderTests
. Setup ( s = > s . Get ( It . IsAny < int > ( ) ) )
. Setup ( s = > s . Get ( It . IsAny < int > ( ) ) )
. Returns ( rootFolder ) ;
. Returns ( rootFolder ) ;
Mocker . GetMock < I Series Service> ( )
Mocker . GetMock < I Artist Service> ( )
. Setup ( s = > s . GetAll Serie s( ) )
. Setup ( s = > s . GetAll Artist s( ) )
. Returns ( new List < Series > ( ) ) ;
. Returns ( new List < Artist > ( ) ) ;
Mocker . GetMock < IDiskProvider > ( )
Mocker . GetMock < IDiskProvider > ( )
. Setup ( s = > s . GetDirectories ( rootFolder . Path ) )
. Setup ( s = > s . GetDirectories ( rootFolder . Path ) )