1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

linux fixes

This commit is contained in:
kay.one 2013-07-26 21:34:11 -07:00
parent 24daa52e86
commit 0d6d9a7021
3 changed files with 18 additions and 8 deletions

View File

@ -3,7 +3,6 @@
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
@ -162,14 +161,14 @@ public void empty_folder_should_return_folder_modified_date()
[Test] [Test]
public void folder_should_return_correct_value_for_last_write() public void folder_should_return_correct_value_for_last_write()
{ {
var appPath = new AppFolderInfo(Subject).AppDataFolder; var testFile = Path.Combine(SandboxFolder, "newfile.txt");
TestLogger.Info("Path is: {0}", appPath); TestLogger.Info("Path is: {0}", testFile);
Subject.WriteAllText(Path.Combine(appPath, "newfile.txt"), ""); Subject.WriteAllText(testFile, "");
Subject.GetLastFolderWrite(appPath).Should().BeOnOrAfter(DateTime.UtcNow.AddMinutes(-10)); Subject.GetLastFolderWrite(SandboxFolder).Should().BeOnOrAfter(DateTime.UtcNow.AddMinutes(-1));
Subject.GetLastFolderWrite(appPath).Should().BeBefore(DateTime.UtcNow); Subject.GetLastFolderWrite(SandboxFolder).Should().BeBefore(DateTime.UtcNow);
} }
[Test] [Test]

View File

@ -6,6 +6,7 @@
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaFileTests namespace NzbDrone.Core.Test.MediaFileTests
{ {
@ -49,7 +50,7 @@ public void exists_should_return_false_if_file_doesnt_exist()
[Test] [Test]
public void GetFileByPath_should_return_EpisodeFile_if_file_exists_in_database() public void GetFileByPath_should_return_EpisodeFile_if_file_exists_in_database()
{ {
var path = @"C:\Test\EpisodeFile.avi"; var path = @"C:\Test\EpisodeFile.avi".AsOsAgnostic();
var episodeFile = Builder<EpisodeFile>.CreateNew() var episodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.Id = 0) .With(f => f.Id = 0)

View File

@ -140,9 +140,19 @@ protected void WithTempAsAppPath()
protected string GetTestFilePath(string fileName) protected string GetTestFilePath(string fileName)
{ {
return Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName); return Path.Combine(SandboxFolder, fileName);
} }
protected string SandboxFolder
{
get
{
var folder = Path.Combine(Directory.GetCurrentDirectory(), "Files");
Directory.CreateDirectory(folder);
return folder;
}
}
protected void VerifyEventPublished<TEvent>() where TEvent : class, IEvent protected void VerifyEventPublished<TEvent>() where TEvent : class, IEvent
{ {
VerifyEventPublished<TEvent>(Times.Once()); VerifyEventPublished<TEvent>(Times.Once());