mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
more linux fixes
This commit is contained in:
parent
b06a58966e
commit
c2b4eadc47
@ -109,43 +109,43 @@ public void get_actual_casing_should_return_original_casing_for_shares()
|
||||
[Test]
|
||||
public void AppDataDirectory_path_test()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\NzbDrone\");
|
||||
GetIAppDirectoryInfo().GetAppDataPath().Should().BeEquivalentTo(@"C:\NzbDrone\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Config_path_test()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetConfigPath().Should().BeEquivalentTo(@"C:\NzbDrone\Config.xml");
|
||||
GetIAppDirectoryInfo().GetConfigPath().Should().BeEquivalentTo(@"C:\NzbDrone\Config.xml".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sanbox()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\");
|
||||
GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdatePackageFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\");
|
||||
GetIAppDirectoryInfo().GetUpdatePackageFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateClientFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\NzbDrone.Update\");
|
||||
GetIAppDirectoryInfo().GetUpdateClientFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\NzbDrone.Update\".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateClientExePath()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone.Update.exe");
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone.Update.exe".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUpdateLogFolder()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\");
|
||||
GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\".AsOsAgnostic());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public void should_not_move_file_if_source_and_destination_are_the_same_path()
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi");
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi").AsOsAgnostic();
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.SeriesId = fakeSeries.Id)
|
||||
@ -80,8 +80,8 @@ public void should_use_EpisodeFiles_quality()
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv");
|
||||
var currentFilename = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", "30.Rock.S01E01.Test.WED-DL.mkv");
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv").AsOsAgnostic();
|
||||
var currentFilename = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", "30.Rock.S01E01.Test.WED-DL.mkv").AsOsAgnostic();
|
||||
const string message = "30 Rock - 1x01 - [WEBDL]";
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
@ -131,8 +131,8 @@ public void should_log_error_and_return_null_when_source_file_does_not_exists()
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv");
|
||||
var currentFilename = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", "30.Rock.S01E01.Test.WED-DL.mkv");
|
||||
var fi = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv").AsOsAgnostic();
|
||||
var currentFilename = Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", "30.Rock.S01E01.Test.WED-DL.mkv").AsOsAgnostic();
|
||||
const string message = "30 Rock - 1x01 - [WEBDL]";
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
|
@ -9,6 +9,7 @@
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFileTests.EpisodeImportTests
|
||||
{
|
||||
@ -22,7 +23,7 @@ public void Setup()
|
||||
{
|
||||
_localEpisode = new LocalEpisode
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
|
||||
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi".AsOsAgnostic(),
|
||||
Size = 100
|
||||
};
|
||||
}
|
||||
@ -36,7 +37,7 @@ public void should_return_false_if_path_and_size_are_the_same()
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
|
||||
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi".AsOsAgnostic(),
|
||||
Size = 100
|
||||
}))
|
||||
.Build()
|
||||
@ -54,7 +55,7 @@ public void should_return_false_if_filename_and_size_are_the_same()
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.avi",
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.avi".AsOsAgnostic(),
|
||||
Size = 100
|
||||
}))
|
||||
.Build()
|
||||
@ -84,7 +85,7 @@ public void should_return_true_if_size_is_different()
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.avi",
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.avi".AsOsAgnostic(),
|
||||
Size = 50
|
||||
}))
|
||||
.Build()
|
||||
@ -102,7 +103,7 @@ public void should_return_true_if_file_names_are_different()
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.pilot.avi",
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.pilot.avi".AsOsAgnostic(),
|
||||
Size = 100
|
||||
}))
|
||||
.Build()
|
||||
@ -124,7 +125,7 @@ public void should_return_false_if_exact_path_exists_in_db()
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.pilot.avi",
|
||||
Path = @"C:\Test\30 Rock\Season 01\30.rock.s01e01.pilot.avi".AsOsAgnostic(),
|
||||
Size = 100
|
||||
}))
|
||||
.Build()
|
||||
|
@ -3,6 +3,7 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests
|
||||
{
|
||||
@ -28,7 +29,7 @@ public void should_be_able_to_get_space_on_unc()
|
||||
[Test]
|
||||
public void should_throw_if_drive_doesnt_exist()
|
||||
{
|
||||
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvilableSpace(@"Z:\NOT_A_REAL_PATH\DOES_NOT_EXIST"));
|
||||
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvilableSpace(@"Z:\NOT_A_REAL_PATH\DOES_NOT_EXIST".AsOsAgnostic()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,16 +7,17 @@
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
|
||||
public class DeleteFileFixture : CoreTest
|
||||
{
|
||||
private void WithRecycleBin()
|
||||
{
|
||||
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin".AsOsAgnostic());
|
||||
}
|
||||
|
||||
private void WithoutRecycleBin()
|
||||
@ -29,7 +30,7 @@ public void should_use_delete_when_recycleBin_is_not_configured()
|
||||
{
|
||||
WithoutRecycleBin();
|
||||
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi";
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi".AsOsAgnostic();
|
||||
|
||||
Mocker.Resolve<RecycleBinProvider>().DeleteFile(path);
|
||||
|
||||
@ -41,23 +42,23 @@ public void should_use_move_when_recycleBin_is_configured()
|
||||
{
|
||||
WithRecycleBin();
|
||||
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi";
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi".AsOsAgnostic();
|
||||
|
||||
Mocker.Resolve<RecycleBinProvider>().DeleteFile(path);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFile(path, @"C:\Test\Recycle Bin\S01E01.avi"), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFile(path, @"C:\Test\Recycle Bin\S01E01.avi".AsOsAgnostic()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_fileSetLastWriteTime_for_each_file()
|
||||
{
|
||||
WithRecycleBin();
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi";
|
||||
var path = @"C:\Test\TV\30 Rock\S01E01.avi".AsOsAgnostic();
|
||||
|
||||
|
||||
Mocker.Resolve<RecycleBinProvider>().DeleteFile(path);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.FileSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\S01E01.avi", It.IsAny<DateTime>()), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.FileSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\S01E01.avi".AsOsAgnostic(), It.IsAny<DateTime>()), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,9 +97,9 @@ public void invalid_folder_path_throws_on_add(string path)
|
||||
[Test]
|
||||
public void adding_duplicated_root_folder_should_throw()
|
||||
{
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Setup(c => c.All()).Returns(new List<RootFolder> { new RootFolder { Path = "C:\\TV" } });
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Setup(c => c.All()).Returns(new List<RootFolder> { new RootFolder { Path = "C:\\TV".AsOsAgnostic() } });
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = @"C:\TV" }));
|
||||
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = @"C:\TV".AsOsAgnostic() }));
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ public static string AsOsAgnostic(this string path)
|
||||
if (path.Length > 2 && path[1] == ':')
|
||||
{
|
||||
path = path.Replace(':', Path.DirectorySeparatorChar);
|
||||
path = Path.DirectorySeparatorChar + path;
|
||||
}
|
||||
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user