|
|
@ -1,8 +1,6 @@
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using FluentAssertions;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Moq;
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
|
|
|
|
using NzbDrone.Core.RootFolders;
|
|
|
|
using NzbDrone.Core.RootFolders;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
@ -34,15 +32,34 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_get_parent_path_from_diskProvider_if_matching_root_folder_is_not_found()
|
|
|
|
public void should_get_parent_path_from_os_path_if_matching_root_folder_is_not_found()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var moviePath = @"T:\Test\Movies\Movie Title".AsOsAgnostic();
|
|
|
|
var moviePath = @"T:\Test\Movies\Movie Title".AsOsAgnostic();
|
|
|
|
|
|
|
|
|
|
|
|
GivenRootFolders(@"C:\Test\Movies".AsOsAgnostic(), @"D:\Test\Movies".AsOsAgnostic());
|
|
|
|
GivenRootFolders(@"C:\Test\Movies".AsOsAgnostic(), @"D:\Test\Movies".AsOsAgnostic());
|
|
|
|
Subject.GetBestRootFolderPath(moviePath);
|
|
|
|
Subject.GetBestRootFolderPath(moviePath).Should().Be(@"T:\Test\Movies".AsOsAgnostic());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_get_parent_path_from_os_path_if_matching_root_folder_is_not_found_for_posix_path()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WindowsOnly();
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
var moviePath = "/mnt/movies/Movie Title";
|
|
|
|
.Verify(v => v.GetParentFolder(moviePath), Times.Once);
|
|
|
|
|
|
|
|
|
|
|
|
GivenRootFolders(@"C:\Test\Movies".AsOsAgnostic(), @"D:\Test\Movies".AsOsAgnostic());
|
|
|
|
|
|
|
|
Subject.GetBestRootFolderPath(moviePath).Should().Be(@"/mnt/movies");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_get_parent_path_from_os_path_if_matching_root_folder_is_not_found_for_windows_path()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PosixOnly();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var moviePath = @"T:\Test\Movies\Movie Title";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GivenRootFolders(@"C:\Test\Movies".AsOsAgnostic(), @"D:\Test\Movies".AsOsAgnostic());
|
|
|
|
|
|
|
|
Subject.GetBestRootFolderPath(moviePath).Should().Be(@"T:\Test\Movies");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|