mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-20 13:06:57 +00:00
Fix some Path Related Tests
This commit is contained in:
parent
2a4141f658
commit
22f19b5cb5
3 changed files with 20 additions and 20 deletions
|
@ -7,8 +7,8 @@ namespace NzbDrone.Common.Test.EnsureTest
|
|||
[TestFixture]
|
||||
public class PathExtensionFixture : TestBase
|
||||
{
|
||||
[TestCase(@"p:\TV Shows\file with, comma.mkv")]
|
||||
[TestCase(@"\\serer\share\file with, comma.mkv")]
|
||||
[TestCase(@"p:\Music\file with, comma.mp3")]
|
||||
[TestCase(@"\\serer\share\file with, comma.mp3")]
|
||||
public void EnsureWindowsPath(string path)
|
||||
{
|
||||
WindowsOnly();
|
||||
|
@ -16,7 +16,7 @@ public void EnsureWindowsPath(string path)
|
|||
}
|
||||
|
||||
|
||||
[TestCase(@"/var/user/file with, comma.mkv")]
|
||||
[TestCase(@"/var/user/file with, comma.mp3")]
|
||||
public void EnsureLinuxPath(string path)
|
||||
{
|
||||
MonoOnly();
|
||||
|
|
|
@ -19,7 +19,7 @@ private IAppFolderInfo GetIAppDirectoryInfo()
|
|||
{
|
||||
var fakeEnvironment = new Mock<IAppFolderInfo>();
|
||||
|
||||
fakeEnvironment.SetupGet(c => c.AppDataFolder).Returns(@"C:\NzbDrone\".AsOsAgnostic());
|
||||
fakeEnvironment.SetupGet(c => c.AppDataFolder).Returns(@"C:\Lidarr\".AsOsAgnostic());
|
||||
|
||||
fakeEnvironment.SetupGet(c => c.TempFolder).Returns(@"C:\Temp\".AsOsAgnostic());
|
||||
|
||||
|
@ -147,8 +147,8 @@ public void path_should_return_parent(string path, string parentPath)
|
|||
[Test]
|
||||
public void path_should_return_parent_for_oversized_path()
|
||||
{
|
||||
var path = @"/media/2e168617-f2ae-43fb-b88c-3663af1c8eea/downloads/sabnzbd/nzbdrone/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories";
|
||||
var parentPath = @"/media/2e168617-f2ae-43fb-b88c-3663af1c8eea/downloads/sabnzbd/nzbdrone/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing";
|
||||
var path = @"/media/2e168617-f2ae-43fb-b88c-3663af1c8eea/downloads/sabnzbd/lidarr/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories";
|
||||
var parentPath = @"/media/2e168617-f2ae-43fb-b88c-3663af1c8eea/downloads/sabnzbd/lidarr/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing/With.Alot.Of.Nested.Directories/Some.Real.Big.Thing";
|
||||
|
||||
path.GetParentPath().Should().Be(parentPath);
|
||||
}
|
||||
|
@ -233,71 +233,71 @@ public void get_actual_casing_should_return_original_casing_for_shares()
|
|||
[Test]
|
||||
public void AppDataDirectory_path_test()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\NzbDrone\".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\Lidarr\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Config_path_test()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetConfigPath().Should().BeEquivalentTo(@"C:\NzbDrone\Config.xml".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetConfigPath().Should().BeEquivalentTo(@"C:\Lidarr\Config.xml".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sandbox()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdatePackageFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\NzbDrone\".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateClientFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\NzbDrone\NzbDrone.Update\".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr\NzbDrone.Update\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateClientExePath()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\NzbDrone.Update.exe".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr.Update.exe".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateLogFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\Lidarr\UpdateLogs\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAncestorFolders_should_return_all_ancestors_in_path_Windows()
|
||||
{
|
||||
WindowsOnly();
|
||||
var path = @"C:\Test\TV\Series Title";
|
||||
var path = @"C:\Test\Music\Artist Title";
|
||||
var result = path.GetAncestorFolders();
|
||||
|
||||
result.Count.Should().Be(4);
|
||||
result[0].Should().Be(@"C:\");
|
||||
result[1].Should().Be(@"Test");
|
||||
result[2].Should().Be(@"TV");
|
||||
result[3].Should().Be(@"Series Title");
|
||||
result[2].Should().Be(@"Music");
|
||||
result[3].Should().Be(@"Artist Title");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux()
|
||||
{
|
||||
MonoOnly();
|
||||
var path = @"/Test/TV/Series Title";
|
||||
var path = @"/Test/Music/Artist Title";
|
||||
var result = path.GetAncestorFolders();
|
||||
|
||||
result.Count.Should().Be(4);
|
||||
result[0].Should().Be(@"/");
|
||||
result[1].Should().Be(@"Test");
|
||||
result[2].Should().Be(@"TV");
|
||||
result[3].Should().Be(@"Series Title");
|
||||
result[2].Should().Be(@"Music");
|
||||
result[3].Should().Be(@"Artist Title");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public void should_start_console_if_app_type_was_service_but_start_failed_becaus
|
|||
|
||||
Subject.Start(AppType.Service, targetFolder);
|
||||
|
||||
Mocker.GetMock<IProcessProvider>().Verify(c => c.SpawnNewProcess("c:\\NzbDrone\\NzbDrone.Console.exe", "/" + StartupContext.NO_BROWSER, null), Times.Once());
|
||||
Mocker.GetMock<IProcessProvider>().Verify(c => c.SpawnNewProcess("c:\\NzbDrone\\Lidarr.Console.exe", "/" + StartupContext.NO_BROWSER, null), Times.Once());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue