mirror of https://github.com/lidarr/Lidarr
Merge pull request #5 from lidarr/fix/Tests
Fixes a few PathExtensionFixture Tests
This commit is contained in:
commit
4df9c745de
|
@ -7,8 +7,8 @@ namespace NzbDrone.Common.Test.EnsureTest
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class PathExtensionFixture : TestBase
|
public class PathExtensionFixture : TestBase
|
||||||
{
|
{
|
||||||
[TestCase(@"p:\TV Shows\file with, comma.mkv")]
|
[TestCase(@"p:\Music\file with, comma.mp3")]
|
||||||
[TestCase(@"\\serer\share\file with, comma.mkv")]
|
[TestCase(@"\\serer\share\file with, comma.mp3")]
|
||||||
public void EnsureWindowsPath(string path)
|
public void EnsureWindowsPath(string path)
|
||||||
{
|
{
|
||||||
WindowsOnly();
|
WindowsOnly();
|
||||||
|
@ -16,7 +16,7 @@ namespace NzbDrone.Common.Test.EnsureTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestCase(@"/var/user/file with, comma.mkv")]
|
[TestCase(@"/var/user/file with, comma.mp3")]
|
||||||
public void EnsureLinuxPath(string path)
|
public void EnsureLinuxPath(string path)
|
||||||
{
|
{
|
||||||
MonoOnly();
|
MonoOnly();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace NzbDrone.Common.Test
|
||||||
{
|
{
|
||||||
var fakeEnvironment = new Mock<IAppFolderInfo>();
|
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());
|
fakeEnvironment.SetupGet(c => c.TempFolder).Returns(@"C:\Temp\".AsOsAgnostic());
|
||||||
|
|
||||||
|
@ -147,8 +147,8 @@ namespace NzbDrone.Common.Test
|
||||||
[Test]
|
[Test]
|
||||||
public void path_should_return_parent_for_oversized_path()
|
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 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/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 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);
|
path.GetParentPath().Should().Be(parentPath);
|
||||||
}
|
}
|
||||||
|
@ -233,71 +233,71 @@ namespace NzbDrone.Common.Test
|
||||||
[Test]
|
[Test]
|
||||||
public void AppDataDirectory_path_test()
|
public void AppDataDirectory_path_test()
|
||||||
{
|
{
|
||||||
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\NzbDrone\".AsOsAgnostic());
|
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\Lidarr\".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Config_path_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]
|
[Test]
|
||||||
public void Sandbox()
|
public void Sandbox()
|
||||||
{
|
{
|
||||||
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\".AsOsAgnostic());
|
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetUpdatePackageFolder()
|
public void GetUpdatePackageFolder()
|
||||||
{
|
{
|
||||||
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\NzbDrone\".AsOsAgnostic());
|
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr\".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetUpdateClientFolder()
|
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]
|
[Test]
|
||||||
public void GetUpdateClientExePath()
|
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]
|
[Test]
|
||||||
public void GetUpdateLogFolder()
|
public void GetUpdateLogFolder()
|
||||||
{
|
{
|
||||||
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\".AsOsAgnostic());
|
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\Lidarr\UpdateLogs\".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetAncestorFolders_should_return_all_ancestors_in_path_Windows()
|
public void GetAncestorFolders_should_return_all_ancestors_in_path_Windows()
|
||||||
{
|
{
|
||||||
WindowsOnly();
|
WindowsOnly();
|
||||||
var path = @"C:\Test\TV\Series Title";
|
var path = @"C:\Test\Music\Artist Title";
|
||||||
var result = path.GetAncestorFolders();
|
var result = path.GetAncestorFolders();
|
||||||
|
|
||||||
result.Count.Should().Be(4);
|
result.Count.Should().Be(4);
|
||||||
result[0].Should().Be(@"C:\");
|
result[0].Should().Be(@"C:\");
|
||||||
result[1].Should().Be(@"Test");
|
result[1].Should().Be(@"Test");
|
||||||
result[2].Should().Be(@"TV");
|
result[2].Should().Be(@"Music");
|
||||||
result[3].Should().Be(@"Series Title");
|
result[3].Should().Be(@"Artist Title");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux()
|
public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
MonoOnly();
|
||||||
var path = @"/Test/TV/Series Title";
|
var path = @"/Test/Music/Artist Title";
|
||||||
var result = path.GetAncestorFolders();
|
var result = path.GetAncestorFolders();
|
||||||
|
|
||||||
result.Count.Should().Be(4);
|
result.Count.Should().Be(4);
|
||||||
result[0].Should().Be(@"/");
|
result[0].Should().Be(@"/");
|
||||||
result[1].Should().Be(@"Test");
|
result[1].Should().Be(@"Test");
|
||||||
result[2].Should().Be(@"TV");
|
result[2].Should().Be(@"Music");
|
||||||
result[3].Should().Be(@"Series Title");
|
result[3].Should().Be(@"Artist Title");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ namespace NzbDrone.Common.Extensions
|
||||||
private const string NZBDRONE_DB = "lidarr.db";
|
private const string NZBDRONE_DB = "lidarr.db";
|
||||||
private const string NZBDRONE_LOG_DB = "logs.db";
|
private const string NZBDRONE_LOG_DB = "logs.db";
|
||||||
private const string NLOG_CONFIG_FILE = "nlog.config";
|
private const string NLOG_CONFIG_FILE = "nlog.config";
|
||||||
private const string UPDATE_CLIENT_EXE = "lidarr.Update.exe";
|
private const string UPDATE_CLIENT_EXE = "Lidarr.Update.exe";
|
||||||
private const string BACKUP_FOLDER = "Backups";
|
private const string BACKUP_FOLDER = "Backups";
|
||||||
|
|
||||||
private static readonly string UPDATE_SANDBOX_FOLDER_NAME = "lidarr_update" + Path.DirectorySeparatorChar;
|
private static readonly string UPDATE_SANDBOX_FOLDER_NAME = "lidarr_update" + Path.DirectorySeparatorChar;
|
||||||
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "lidarr" + Path.DirectorySeparatorChar;
|
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "Lidarr" + Path.DirectorySeparatorChar;
|
||||||
private static readonly string UPDATE_BACKUP_FOLDER_NAME = "lidarr_backup" + Path.DirectorySeparatorChar;
|
private static readonly string UPDATE_BACKUP_FOLDER_NAME = "lidarr_backup" + Path.DirectorySeparatorChar;
|
||||||
private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "lidarr_appdata_backup" + Path.DirectorySeparatorChar;
|
private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "lidarr_appdata_backup" + Path.DirectorySeparatorChar;
|
||||||
private static readonly string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update" + Path.DirectorySeparatorChar;
|
private static readonly string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update" + Path.DirectorySeparatorChar;
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace NzbDrone.Update.Test
|
||||||
|
|
||||||
Subject.Start(AppType.Service, targetFolder);
|
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);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue