more linux fixes

pull/4/head
kay.one 11 years ago
parent 23b2c9eef5
commit b06a58966e

@ -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) public void EnsureLinuxPath(string path)
{ {
LinuxOnly(); LinuxOnly();

@ -17,15 +17,18 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
{ {
private const string _nzbUrl = "http://www.nzbs.com/url"; private const string _nzbUrl = "http://www.nzbs.com/url";
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL"; private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
private const string _pneumaticFolder = @"d:\nzb\pneumatic\"; private string _pneumaticFolder;
private const string _sabDrop = @"d:\unsorted tv\"; private string _sabDrop;
private string _nzbPath; private string _nzbPath;
private RemoteEpisode _remoteEpisode; private RemoteEpisode _remoteEpisode;
[SetUp] [SetUp]
public void 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.PneumaticFolder).Returns(_pneumaticFolder);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop); Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
@ -54,7 +57,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
{ {
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue(); 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] [Test]

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

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

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

Loading…
Cancel
Save