diff --git a/src/NzbDrone.Common.Test/DiskTests/DiskTransferServiceFixture.cs b/src/NzbDrone.Common.Test/DiskTests/DiskTransferServiceFixture.cs index 3e2ed7590..10f9379a3 100644 --- a/src/NzbDrone.Common.Test/DiskTests/DiskTransferServiceFixture.cs +++ b/src/NzbDrone.Common.Test/DiskTests/DiskTransferServiceFixture.cs @@ -38,7 +38,7 @@ namespace NzbDrone.Common.Test.DiskTests [Test] public void should_use_verified_transfer_on_mono() { - MonoOnly(); + PosixOnly(); Subject.VerificationMode.Should().Be(DiskTransferVerificationMode.TryTransactional); } diff --git a/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs index f3b127b31..b130f82a6 100644 --- a/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Common.Test.EnsureTest [TestCase(@"/var/user/file with, comma.mp3")] public void EnsureLinuxPath(string path) { - MonoOnly(); + PosixOnly(); Ensure.That(path, () => path).IsValidPath(); } } diff --git a/src/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs index 269e4145c..31cfe4041 100644 --- a/src/NzbDrone.Common.Test/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/PathExtensionFixture.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Common.Test [TestCase(@"//CAPITAL//lower// ", @"/CAPITAL/lower")] public void Clean_Path_Linux(string dirty, string clean) { - MonoOnly(); + PosixOnly(); var result = dirty.CleanFilePath(); result.Should().Be(clean); @@ -153,14 +153,14 @@ namespace NzbDrone.Common.Test [TestCase(@"/test", "/")] public void path_should_return_parent_mono(string path, string parentPath) { - MonoOnly(); + PosixOnly(); path.GetParentPath().Should().Be(parentPath); } [Test] public void path_should_return_parent_for_oversized_path() { - MonoOnly(); + PosixOnly(); // This test will fail on Windows if long path support is not enabled: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/ // It will also fail if the app isn't configured to use long path (such as resharper): https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/ @@ -233,7 +233,7 @@ namespace NzbDrone.Common.Test [Test] public void get_actual_casing_should_return_original_value_in_linux() { - MonoOnly(); + PosixOnly(); var path = Directory.GetCurrentDirectory(); path.GetActualCasing().Should().Be(path); path.GetActualCasing().Should().Be(path); @@ -307,7 +307,7 @@ namespace NzbDrone.Common.Test [Test] public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux() { - MonoOnly(); + PosixOnly(); var path = @"/Test/Music/Artist Title"; var result = path.GetAncestorFolders(); diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 8651f6861..fa017bfe3 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -142,6 +142,7 @@ namespace NzbDrone.Common.EnvironmentInfo { var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location; if (currentAssemblyLocation.ToLower().Contains("_output")) return true; + if (currentAssemblyLocation.ToLower().Contains("_tests")) return true; } catch { @@ -152,6 +153,7 @@ namespace NzbDrone.Common.EnvironmentInfo if (lowerCurrentDir.Contains("vsts")) return true; if (lowerCurrentDir.Contains("buildagent")) return true; if (lowerCurrentDir.Contains("_output")) return true; + if (lowerCurrentDir.Contains("_tests")) return true; return false; } diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs index acb65a85c..ef33627c2 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs @@ -443,7 +443,7 @@ namespace NzbDrone.Core.Test.Download [Test] public void should_warn_if_path_is_not_valid_for_linux() { - MonoOnly(); + PosixOnly(); _trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\Invalid\Mono\Path"); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs index d56ff463d..087501f7f 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -17,9 +18,12 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } [Test] - public void should_return_ok_if_windows() + public void should_return_ok_if_not_mono() { - WindowsOnly(); + if (PlatformInfo.IsMono) + { + throw new IgnoreException("non mono specific test"); + } Subject.Check().ShouldBeOk(); } diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs index 310544e5c..751ba2e7f 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/UpdateCheckFixture.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [Test] public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled() { - MonoOnly(); + PosixOnly(); const string startupFolder = @"/opt/nzbdrone"; @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [Test] public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled() { - MonoOnly(); + PosixOnly(); const string startupFolder = @"/opt/nzbdrone"; const string uiFolder = @"/opt/nzbdrone/UI"; @@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [Test] public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled() { - MonoOnly(); + PosixOnly(); Mocker.GetMock() .Setup(s => s.UpdateAutomatically) diff --git a/src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTests/FilterFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTests/FilterFixture.cs index c65aea5c2..74f683506 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTests/FilterFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTests/FilterFixture.cs @@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileServiceTests [TestCase(FilterFilesType.Matched)] public void filter_should_return_none_existing_files_not_ignoring_case(FilterFilesType filter) { - MonoOnly(); + PosixOnly(); var files = GivenFiles(new [] { diff --git a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/NotUnpackingSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/NotUnpackingSpecificationFixture.cs index cfdec1aa4..fe2de539e 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/NotUnpackingSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/NotUnpackingSpecificationFixture.cs @@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications [Test] public void should_return_false_if_unopacking_on_linux() { - MonoOnly(); + PosixOnly(); GivenInWorkingFolder(); GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5)); diff --git a/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs b/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs index 06fec4ff1..2701e878e 100644 --- a/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs +++ b/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs @@ -181,7 +181,7 @@ namespace NzbDrone.Core.Test.UpdateTests } [Test] - [Platform("Mono")] + [Platform(Exclude="Win")] public void should_run_script_if_configured() { const string scriptPath = "/tmp/lidarr/update.sh"; @@ -194,7 +194,7 @@ namespace NzbDrone.Core.Test.UpdateTests } [Test] - [Platform("Mono")] + [Platform(Exclude="Win")] public void should_throw_if_script_is_not_set() { const string scriptPath = "/tmp/lidarr/update.sh"; @@ -208,7 +208,7 @@ namespace NzbDrone.Core.Test.UpdateTests } [Test] - [Platform("Mono")] + [Platform(Exclude="Win")] public void should_throw_if_script_is_null() { const string scriptPath = "/tmp/lidarr/update.sh"; @@ -222,7 +222,7 @@ namespace NzbDrone.Core.Test.UpdateTests } [Test] - [Platform("Mono")] + [Platform(Exclude="Win")] public void should_throw_if_script_path_does_not_exist() { const string scriptPath = "/tmp/lidarr/update.sh"; diff --git a/src/NzbDrone.Core.Test/ValidationTests/SystemFolderValidatorFixture.cs b/src/NzbDrone.Core.Test/ValidationTests/SystemFolderValidatorFixture.cs index f6e4e4fb1..cff197390 100644 --- a/src/NzbDrone.Core.Test/ValidationTests/SystemFolderValidatorFixture.cs +++ b/src/NzbDrone.Core.Test/ValidationTests/SystemFolderValidatorFixture.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.ValidationTests [Test] public void should_not_be_valid_if_set_to_bin_folder() { - MonoOnly(); + PosixOnly(); var bin = OsInfo.IsOsx ? "/System" : "/bin"; var artist = Builder.CreateNew() @@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.ValidationTests [Test] public void should_not_be_valid_if_child_of_bin_folder() { - MonoOnly(); + PosixOnly(); var bin = OsInfo.IsOsx ? "/System" : "/bin"; var artist = Builder.CreateNew() diff --git a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs index 885d68688..fd4c04594 100644 --- a/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs +++ b/src/NzbDrone.Mono.Test/DiskProviderTests/DiskProviderFixture.cs @@ -14,12 +14,12 @@ using NzbDrone.Mono.Disk; namespace NzbDrone.Mono.Test.DiskProviderTests { [TestFixture] - [Platform("Mono")] + [Platform(Exclude="Win")] public class DiskProviderFixture : DiskProviderFixtureBase { public DiskProviderFixture() { - MonoOnly(); + PosixOnly(); } protected override void SetWritePermissions(string path, bool writable) diff --git a/src/NzbDrone.Mono.Test/DiskProviderTests/FreeSpaceFixture.cs b/src/NzbDrone.Mono.Test/DiskProviderTests/FreeSpaceFixture.cs index 7ba5d8414..7b6d8bbac 100644 --- a/src/NzbDrone.Mono.Test/DiskProviderTests/FreeSpaceFixture.cs +++ b/src/NzbDrone.Mono.Test/DiskProviderTests/FreeSpaceFixture.cs @@ -1,16 +1,13 @@ -using System.Collections.Generic; -using System.IO; -using FluentAssertions; using Moq; -using NUnit.Framework; -using NzbDrone.Common.Disk; using NzbDrone.Common.Test.DiskTests; using NzbDrone.Mono.Disk; +using NUnit.Framework; +using FluentAssertions; namespace NzbDrone.Mono.Test.DiskProviderTests { [TestFixture] - [Platform("Mono")] + [Platform(Exclude="Win")] public class FreeSpaceFixture : FreeSpaceFixtureBase { public FreeSpaceFixture() diff --git a/src/NzbDrone.Test.Common/TestBase.cs b/src/NzbDrone.Test.Common/TestBase.cs index 9e21ab010..618643419 100644 --- a/src/NzbDrone.Test.Common/TestBase.cs +++ b/src/NzbDrone.Test.Common/TestBase.cs @@ -160,6 +160,14 @@ namespace NzbDrone.Test.Common } } + protected void PosixOnly() + { + if (OsInfo.IsWindows) + { + throw new IgnoreException("non windows specific test"); + } + } + protected void MonoOnly() { if (!PlatformInfo.IsMono)