mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
moved data from Roaming to ProgramData.
Cleaned up DiskProvider
This commit is contained in:
parent
7ff1335a2e
commit
d60b863e14
33 changed files with 202 additions and 242 deletions
|
@ -17,7 +17,7 @@ namespace NzbDrone.Common.Test
|
|||
{
|
||||
WithTempAsAppPath();
|
||||
|
||||
var configFile = Mocker.Resolve<IAppDirectoryInfo>().GetConfigPath();
|
||||
var configFile = Mocker.Resolve<IAppFolderInfo>().GetConfigPath();
|
||||
|
||||
if (File.Exists(configFile))
|
||||
File.Delete(configFile);
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace NzbDrone.Common.Test
|
|||
public void moveFile_should_overwrite_existing_file()
|
||||
{
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
|
||||
var targetPath = Path.Combine(_binFolderCopy.FullName, "file.move");
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace NzbDrone.Common.Test
|
|||
public void moveFile_should_not_move_overwrite_itself()
|
||||
{
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
|
||||
var targetPath = _binFolderCopy.GetFiles("*.dll", SearchOption.AllDirectories).First().FullName;
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace NzbDrone.Common.Test
|
|||
{
|
||||
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
|
||||
|
||||
VerifyCopy();
|
||||
|
@ -97,13 +97,13 @@ namespace NzbDrone.Common.Test
|
|||
|
||||
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
|
||||
//Delete Random File
|
||||
_binFolderCopy.Refresh();
|
||||
_binFolderCopy.GetFiles("*.*", SearchOption.AllDirectories).First().Delete();
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
|
||||
|
||||
VerifyCopy();
|
||||
|
@ -114,12 +114,12 @@ namespace NzbDrone.Common.Test
|
|||
{
|
||||
|
||||
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyDirectory(_binFolder.FullName, _binFolderMove.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderCopy.FullName);
|
||||
Subject.CopyFolder(_binFolder.FullName, _binFolderMove.FullName);
|
||||
VerifyCopy();
|
||||
|
||||
|
||||
Subject.MoveDirectory(_binFolderCopy.FullName, _binFolderMove.FullName);
|
||||
Subject.MoveFolder(_binFolderCopy.FullName, _binFolderMove.FullName);
|
||||
|
||||
|
||||
VerifyMove();
|
||||
|
@ -166,11 +166,11 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void folder_should_return_correct_value_for_last_write()
|
||||
{
|
||||
var appPath = new AppDirectoryInfo().WorkingDirectory;
|
||||
var appPath = new AppFolderInfo(Subject).AppDataFolder;
|
||||
|
||||
TestLogger.Info("Path is: {0}", appPath);
|
||||
|
||||
Subject.WriteAllText(Path.Combine(appPath,"newfile.txt"), "");
|
||||
Subject.WriteAllText(Path.Combine(appPath, "newfile.txt"), "");
|
||||
|
||||
Subject.GetLastFolderWrite(appPath).Should().BeOnOrAfter(DateTime.UtcNow.AddMinutes(-10));
|
||||
Subject.GetLastFolderWrite(appPath).Should().BeBefore(DateTime.UtcNow);
|
||||
|
@ -184,18 +184,6 @@ namespace NzbDrone.Common.Test
|
|||
Console.WriteLine(new DirectoryInfo(@"C:\DRIVERS").LastWriteTimeUtc);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsChildOfPath_should_return_true_when_it_is_a_child()
|
||||
{
|
||||
Subject.IsChildOfPath(@"C:\Test\TV", @"C:\Test").Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsChildOfPath_should_return_false_when_it_is_not_a_child()
|
||||
{
|
||||
Subject.IsChildOfPath(@"C:\NOT_Test\TV", @"C:\Test").Should().BeFalse();
|
||||
}
|
||||
|
||||
private void VerifyCopy()
|
||||
{
|
||||
_binFolder.Refresh();
|
||||
|
|
|
@ -7,22 +7,22 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Common.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class IAppDirectoryInfoTest : TestBase<AppDirectoryInfo>
|
||||
public class IAppDirectoryInfoTest : TestBase<AppFolderInfo>
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void StartupPath_should_not_be_empty()
|
||||
{
|
||||
Subject.StartUpPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(Subject.StartUpPath).Should().BeTrue("Path is not rooted");
|
||||
Subject.StartUpFolder.Should().NotBeBlank();
|
||||
Path.IsPathRooted(Subject.StartUpFolder).Should().BeTrue("Path is not rooted");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplicationPath_should_not_be_empty()
|
||||
{
|
||||
Subject.WorkingDirectory.Should().NotBeBlank();
|
||||
Path.IsPathRooted(Subject.WorkingDirectory).Should().BeTrue("Path is not rooted");
|
||||
Subject.AppDataFolder.Should().NotBeBlank();
|
||||
Path.IsPathRooted(Subject.AppDataFolder).Should().BeTrue("Path is not rooted");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ namespace NzbDrone.Common.Test
|
|||
public class PathExtensionFixture : TestBase
|
||||
{
|
||||
|
||||
private IAppDirectoryInfo GetIAppDirectoryInfo()
|
||||
private IAppFolderInfo GetIAppDirectoryInfo()
|
||||
{
|
||||
var fakeEnvironment = new Mock<IAppDirectoryInfo>();
|
||||
var fakeEnvironment = new Mock<IAppFolderInfo>();
|
||||
|
||||
fakeEnvironment.SetupGet(c => c.WorkingDirectory).Returns(@"C:\NzbDrone\");
|
||||
fakeEnvironment.SetupGet(c => c.AppDataFolder).Returns(@"C:\NzbDrone\");
|
||||
|
||||
fakeEnvironment.SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
fakeEnvironment.SetupGet(c => c.TempFolder).Returns(@"C:\Temp\");
|
||||
|
||||
return fakeEnvironment.Object;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue