more linux fixes

This commit is contained in:
kay.one 2013-07-25 22:29:59 -07:00
parent 23b2c9eef5
commit b06a58966e
5 changed files with 27 additions and 34 deletions

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Common.Test.EnsureTest
}
[TestCase(@"var/user/file with, comma.mkv")]
[TestCase(@"/var/user/file with, comma.mkv")]
public void EnsureLinuxPath(string path)
{
LinuxOnly();

View File

@ -17,15 +17,18 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
private const string _nzbUrl = "http://www.nzbs.com/url";
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
private const string _pneumaticFolder = @"d:\nzb\pneumatic\";
private const string _sabDrop = @"d:\unsorted tv\";
private string _pneumaticFolder;
private string _sabDrop;
private string _nzbPath;
private RemoteEpisode _remoteEpisode;
[SetUp]
public void Setup()
{
_nzbPath = _pneumaticFolder + _title + ".nzb";
_pneumaticFolder = @"d:\nzb\pneumatic\".AsOsAgnostic();
_nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic();
_sabDrop = @"d:\unsorted tv\".AsOsAgnostic();
Mocker.GetMock<IConfigService>().SetupGet(c => c.PneumaticFolder).Returns(_pneumaticFolder);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
@ -54,7 +57,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue();
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath),Times.Once());
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
}
[Test]
@ -73,7 +76,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
WithFailedDownload();
Subject.DownloadNzb(_remoteEpisode).Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}

View File

@ -20,16 +20,12 @@ namespace NzbDrone.Core.Test.MediaFileTests
[TestFixture]
public class DropFolderImportServiceFixture : CoreTest<DownloadedEpisodesImportService>
{
private EpisodeFile _fakeEpisodeFile;
private string[] _subFolders = new[] { "c:\\root\\foldername" };
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext" };
private string[] _subFolders = new[] { "c:\\root\\foldername".AsOsAgnostic() };
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext".AsOsAgnostic() };
[SetUp]
public void Setup()
{
_fakeEpisodeFile = Builder<EpisodeFile>.CreateNew().Build();
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(_videoFiles);
@ -40,7 +36,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
.Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
.Returns("c:\\drop\\");
.Returns("c:\\drop\\".AsOsAgnostic());
Mocker.GetMock<IImportApprovedEpisodes>()
.Setup(s => s.Import(It.IsAny<List<ImportDecision>>(), true))
@ -146,7 +142,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
public void should_remove_unpack_from_folder_name(string prefix)
{
var folderName = "30.rock.s01e01.pilot.hdtv-lol";
var folders = new[] { String.Format(@"C:\Test\Unsorted\{0}{1}", prefix, folderName) };
var folders = new[] { String.Format(@"C:\Test\Unsorted\{0}{1}", prefix, folderName).AsOsAgnostic() };
Mocker.GetMock<IDiskProvider>()
.Setup(c => c.GetDirectories(It.IsAny<string>()))

View File

@ -5,6 +5,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.OrganizerTests
{
@ -12,19 +13,11 @@ namespace NzbDrone.Core.Test.OrganizerTests
public class BuildFilePathFixture : CoreTest<FileNameBuilder>
{
private Series _series;
private NamingConfig namingConfig;
[SetUp]
public void Setup()
{
_series = Builder<Series>
.CreateNew()
.With(s => s.Title = "South Park")
.Build();
namingConfig = new NamingConfig();
@ -42,13 +35,13 @@ namespace NzbDrone.Core.Test.OrganizerTests
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Title = "30 Rock")
.With(s => s.Path = @"C:\Test\30 Rock")
.With(s => s.Path = @"C:\Test\30 Rock".AsOsAgnostic())
.With(s => s.SeasonFolder = useSeasonFolder)
.Build();
Mocker.GetMock<IConfigService>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat);
Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath);
Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic());
}
}
}

View File

@ -8,16 +8,17 @@ using NzbDrone.Common;
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 DeleteDirectoryFixture : 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()
@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
WithoutRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
@ -42,11 +43,11 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
WithRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock"), Times.Once());
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic()), Times.Once());
}
[Test]
@ -54,21 +55,21 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
WithRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
Mocker.GetMock<IDiskProvider>().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock", It.IsAny<DateTime>()), Times.Once());
Mocker.GetMock<IDiskProvider>().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), It.IsAny<DateTime>()), Times.Once());
}
[Test]
public void should_call_fileSetLastWriteTime_for_each_file()
{
WithRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock", SearchOption.AllDirectories))
.Returns(new[]{ "File1", "File2", "File3" });
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), SearchOption.AllDirectories))
.Returns(new[] { "File1", "File2", "File3" });
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);