diff --git a/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs b/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs index 1d5cd62ff..650158a92 100644 --- a/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs +++ b/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs @@ -16,7 +16,7 @@ public void EnsureWindowsPath(string path) } - [TestCase(@"var/user/file with, comma.mkv")] + [TestCase(@"/var/user/file with, comma.mkv")] public void EnsureLinuxPath(string path) { LinuxOnly(); diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs index d02080eff..90dfdc2a1 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs @@ -17,15 +17,18 @@ public class PneumaticProviderFixture : CoreTest { 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().SetupGet(c => c.PneumaticFolder).Returns(_pneumaticFolder); Mocker.GetMock().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop); @@ -54,7 +57,7 @@ public void should_download_file_if_it_doesnt_exist() { Subject.DownloadNzb(_remoteEpisode).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath),Times.Once()); + Mocker.GetMock().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once()); } [Test] @@ -73,7 +76,7 @@ public void should_return_false_on_failed_download() WithFailedDownload(); Subject.DownloadNzb(_remoteEpisode).Should().BeFalse(); - + ExceptionVerification.ExpectedWarns(1); } diff --git a/NzbDrone.Core.Test/MediaFileTests/DropFolderImportServiceFixture.cs b/NzbDrone.Core.Test/MediaFileTests/DropFolderImportServiceFixture.cs index 08f64a170..49eb46543 100644 --- a/NzbDrone.Core.Test/MediaFileTests/DropFolderImportServiceFixture.cs +++ b/NzbDrone.Core.Test/MediaFileTests/DropFolderImportServiceFixture.cs @@ -20,16 +20,12 @@ namespace NzbDrone.Core.Test.MediaFileTests [TestFixture] public class DropFolderImportServiceFixture : CoreTest { - 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.CreateNew().Build(); - Mocker.GetMock().Setup(c => c.GetVideoFiles(It.IsAny(), It.IsAny())) .Returns(_videoFiles); @@ -40,7 +36,7 @@ public void Setup() .Returns(true); Mocker.GetMock().SetupGet(c => c.DownloadedEpisodesFolder) - .Returns("c:\\drop\\"); + .Returns("c:\\drop\\".AsOsAgnostic()); Mocker.GetMock() .Setup(s => s.Import(It.IsAny>(), true)) @@ -146,7 +142,7 @@ public void should_delete_folder_if_files_were_imported() 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() .Setup(c => c.GetDirectories(It.IsAny())) diff --git a/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs b/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs index 36860b135..40c7e43c2 100644 --- a/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs +++ b/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs @@ -5,6 +5,7 @@ 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 { - private Series _series; - private NamingConfig namingConfig; [SetUp] public void Setup() { - _series = Builder - .CreateNew() - .With(s => s.Title = "South Park") - .Build(); - - namingConfig = new NamingConfig(); @@ -42,13 +35,13 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea { var fakeSeries = Builder.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().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()); } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs index 8d0ae4e7a..aa68c1139 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs @@ -8,16 +8,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 DeleteDirectoryFixture : CoreTest { private void WithRecycleBin() { - Mocker.GetMock().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin"); + Mocker.GetMock().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin".AsOsAgnostic()); } private void WithoutRecycleBin() @@ -30,7 +31,7 @@ public void should_use_delete_when_recycleBin_is_not_configured() { WithoutRecycleBin(); - var path = @"C:\Test\TV\30 Rock"; + var path = @"C:\Test\TV\30 Rock".AsOsAgnostic(); Mocker.Resolve().DeleteFolder(path); @@ -42,11 +43,11 @@ public void should_use_move_when_recycleBin_is_configured() { WithRecycleBin(); - var path = @"C:\Test\TV\30 Rock"; + var path = @"C:\Test\TV\30 Rock".AsOsAgnostic(); Mocker.Resolve().DeleteFolder(path); - Mocker.GetMock().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock"), Times.Once()); + Mocker.GetMock().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic()), Times.Once()); } [Test] @@ -54,21 +55,21 @@ public void should_call_directorySetLastWriteTime() { WithRecycleBin(); - var path = @"C:\Test\TV\30 Rock"; + var path = @"C:\Test\TV\30 Rock".AsOsAgnostic(); Mocker.Resolve().DeleteFolder(path); - Mocker.GetMock().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock", It.IsAny()), Times.Once()); + Mocker.GetMock().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), It.IsAny()), 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().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock", SearchOption.AllDirectories)) - .Returns(new[]{ "File1", "File2", "File3" }); + Mocker.GetMock().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), SearchOption.AllDirectories)) + .Returns(new[] { "File1", "File2", "File3" }); Mocker.Resolve().DeleteFolder(path);