From edea488dbe4ab89f2d357b5cb6df91691c0a5fa9 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 1 Apr 2016 19:19:32 -0700 Subject: [PATCH] Upgrade to NUnit3 --- .gitignore | 1 + build.sh | 4 +- integration_mono.sh | 8 ---- .../NzbDrone.Api.Test.csproj | 8 ++-- src/NzbDrone.Api.Test/packages.config | 2 +- .../NzbDrone.Host.Test.csproj | 6 +-- src/NzbDrone.App.Test/packages.config | 2 +- .../NzbDrone.Automation.Test.csproj | 6 +-- src/NzbDrone.Automation.Test/packages.config | 2 +- .../CacheTests/CachedFixture.cs | 4 +- .../NzbDrone.Common.Test.csproj | 6 +-- .../PathExtensionFixture.cs | 4 +- .../ProcessProviderTests.cs | 15 ++++++- .../ServiceProviderTests.cs | 11 +++-- src/NzbDrone.Common.Test/packages.config | 2 +- .../SearchDefinitionFixture.cs | 17 +++---- .../DatabaseTargetFixture.cs | 2 + .../NotificationTests/ProwlProviderTest.cs | 2 + .../NzbDrone.Core.Test.csproj | 6 +-- src/NzbDrone.Core.Test/packages.config | 2 +- .../CommandIntegerationTests.cs | 2 +- .../NzbDrone.Integration.Test.csproj | 6 +-- src/NzbDrone.Integration.Test/packages.config | 2 +- .../NzbDrone.Libraries.Test.csproj | 8 ++-- src/NzbDrone.Libraries.Test/packages.config | 2 +- .../NzbDrone.Mono.Test.csproj | 8 ++-- src/NzbDrone.Mono.Test/packages.config | 2 +- .../Categories/ManualTestAttribute.cs | 13 ++++++ src/NzbDrone.Test.Common/LoggingTest.cs | 3 +- .../NzbDrone.Test.Common.csproj | 7 +-- src/NzbDrone.Test.Common/packages.config | 2 +- .../NzbDrone.Update.Test.csproj | 6 +-- src/NzbDrone.Update.Test/packages.config | 2 +- .../NzbDrone.Windows.Test.csproj | 7 +-- src/NzbDrone.Windows.Test/packages.config | 2 +- test.sh | 44 +++++++++++++++++++ tests_mono.sh | 10 ----- 37 files changed, 151 insertions(+), 85 deletions(-) delete mode 100644 integration_mono.sh create mode 100644 src/NzbDrone.Test.Common/Categories/ManualTestAttribute.cs create mode 100644 test.sh delete mode 100644 tests_mono.sh diff --git a/.gitignore b/.gitignore index 8b383bbbe..06b734042 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,4 @@ output/* ._* _start +_temp_*/**/* diff --git a/build.sh b/build.sh index adf5940bc..e45c949e9 100755 --- a/build.sh +++ b/build.sh @@ -208,9 +208,9 @@ PackageTests() find $sourceFolder -path $testSearchPattern -exec cp -r -u -T "{}" $testPackageFolder \; if [ $runtime = "dotnet" ] ; then - $nuget install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder + $nuget install NUnit.ConsoleRunner -Version 3.2.0 -Output $testPackageFolder else - mono $nuget install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder + mono $nuget install NUnit.ConsoleRunner -Version 3.2.0 -Output $testPackageFolder fi cp $outputFolder/*.dll $testPackageFolder diff --git a/integration_mono.sh b/integration_mono.sh deleted file mode 100644 index 1df48b91f..000000000 --- a/integration_mono.sh +++ /dev/null @@ -1,8 +0,0 @@ -EXCLUDE="-exclude:Windows -include:IntegrationTest" -TESTDIR="." -NUNIT="$TESTDIR/NUnit.Runners.2.6.1/tools/nunit-console-x86.exe" - -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Api.Result.xml $TESTDIR/NzbDrone.Api.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Core.Result.xml $TESTDIR/NzbDrone.Core.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Integration.Result.xml $TESTDIR/NzbDrone.Integration.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Common.Result.xml $TESTDIR/NzbDrone.Common.Test.dll diff --git a/src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj b/src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj index a6f570544..165975e05 100644 --- a/src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj +++ b/src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj @@ -46,9 +46,9 @@ ..\packages\FluentAssertions.4.2.1\lib\net40\FluentAssertions.Core.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True @@ -111,4 +111,4 @@ --> - + \ No newline at end of file diff --git a/src/NzbDrone.Api.Test/packages.config b/src/NzbDrone.Api.Test/packages.config index df38e9b02..1c01db85a 100644 --- a/src/NzbDrone.Api.Test/packages.config +++ b/src/NzbDrone.Api.Test/packages.config @@ -3,6 +3,6 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj b/src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj index d8206a12a..448b995ff 100644 --- a/src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj +++ b/src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj @@ -49,9 +49,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True diff --git a/src/NzbDrone.App.Test/packages.config b/src/NzbDrone.App.Test/packages.config index b2b405c63..ee0448a93 100644 --- a/src/NzbDrone.App.Test/packages.config +++ b/src/NzbDrone.App.Test/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj index 55a08ada8..5f8b7f535 100644 --- a/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj +++ b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj @@ -50,9 +50,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True diff --git a/src/NzbDrone.Automation.Test/packages.config b/src/NzbDrone.Automation.Test/packages.config index 209d87558..17eb50eb5 100644 --- a/src/NzbDrone.Automation.Test/packages.config +++ b/src/NzbDrone.Automation.Test/packages.config @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs b/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs index 1d91558a6..54b2a0e01 100644 --- a/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs +++ b/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs @@ -89,7 +89,7 @@ namespace NzbDrone.Common.Test.CacheTests int hitCount = 0; _cachedString = new Cached(); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 10; i++) { _cachedString.Get("key", () => { @@ -97,7 +97,7 @@ namespace NzbDrone.Common.Test.CacheTests return null; }, TimeSpan.FromMilliseconds(300)); - Thread.Sleep(10); + Thread.Sleep(100); } hitCount.Should().BeInRange(3, 6); diff --git a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj index d97d0f800..338a9e926 100644 --- a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj +++ b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj @@ -49,9 +49,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True diff --git a/src/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs index bf03aa666..050c98296 100644 --- a/src/NzbDrone.Common.Test/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/PathExtensionFixture.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.Categories; namespace NzbDrone.Common.Test { @@ -153,7 +154,7 @@ namespace NzbDrone.Common.Test } [Test] - [Ignore] + [Ignore("Parent, not Grandparent")] public void should_not_be_parent_when_it_is_grandparent() { var path = Path.Combine(_parent, "parent", "child"); @@ -222,6 +223,7 @@ namespace NzbDrone.Common.Test [Test] [Explicit] + [ManualTest] public void get_actual_casing_should_return_original_casing_for_shares() { var path = @"\\server\Pool\Apps"; diff --git a/src/NzbDrone.Common.Test/ProcessProviderTests.cs b/src/NzbDrone.Common.Test/ProcessProviderTests.cs index 099defbe9..7d2a6af5d 100644 --- a/src/NzbDrone.Common.Test/ProcessProviderTests.cs +++ b/src/NzbDrone.Common.Test/ProcessProviderTests.cs @@ -31,10 +31,21 @@ namespace NzbDrone.Common.Test [TearDown] public void TearDown() { - Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => c.Kill()); + Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => + { + try + { + c.Kill(); + } + catch (Win32Exception ex) + { + TestLogger.Warn(ex, "{0} when killing process", ex.Message); + throw; + } + + }); } - [Test] public void GetById_should_return_null_if_process_doesnt_exist() { diff --git a/src/NzbDrone.Common.Test/ServiceProviderTests.cs b/src/NzbDrone.Common.Test/ServiceProviderTests.cs index 88bf733e7..68d7b1789 100644 --- a/src/NzbDrone.Common.Test/ServiceProviderTests.cs +++ b/src/NzbDrone.Common.Test/ServiceProviderTests.cs @@ -2,7 +2,9 @@ using System.ServiceProcess; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.Categories; namespace NzbDrone.Common.Test { @@ -13,7 +15,6 @@ namespace NzbDrone.Common.Test private const string ALWAYS_INSTALLED_SERVICE = "SCardSvr"; //Smart Card private const string TEMP_SERVICE_NAME = "NzbDrone_Nunit"; - [SetUp] public void Setup() { @@ -24,8 +25,10 @@ namespace NzbDrone.Common.Test [TearDown] public void TearDown() { - WindowsOnly(); - CleanupService(); + if (OsInfo.IsWindows) + { + CleanupService(); + } } @@ -70,6 +73,7 @@ namespace NzbDrone.Common.Test [Test] [Explicit] + [ManualTest] public void UnInstallService() { Subject.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME); @@ -78,6 +82,7 @@ namespace NzbDrone.Common.Test [Test] [Explicit] + [ManualTest] public void Should_be_able_to_start_and_stop_service() { Subject.GetService(ALWAYS_INSTALLED_SERVICE).Status diff --git a/src/NzbDrone.Common.Test/packages.config b/src/NzbDrone.Common.Test/packages.config index 9c4b52f79..8da0d520a 100644 --- a/src/NzbDrone.Common.Test/packages.config +++ b/src/NzbDrone.Common.Test/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs index 4da3587f7..02c4db4bb 100644 --- a/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Test.Framework; @@ -8,16 +9,16 @@ namespace NzbDrone.Core.Test.IndexerSearchTests { public class SearchDefinitionFixture : CoreTest { - [TestCase("Betty White's Off Their Rockers", Result = "Betty+Whites+Off+Their+Rockers")] - [TestCase("Star Wars: The Clone Wars", Result = "Star+Wars+The+Clone+Wars")] - [TestCase("Hawaii Five-0", Result = "Hawaii+Five+0")] - [TestCase("Franklin & Bash", Result = "Franklin+and+Bash")] - [TestCase("Chicago P.D.", Result = "Chicago+PD")] - [TestCase("Kourtney And Khlo\u00E9 Take The Hamptons", Result = "Kourtney+And+Khloe+Take+The+Hamptons")] - public string should_replace_some_special_characters(string input) + [TestCase("Betty White's Off Their Rockers", "Betty+Whites+Off+Their+Rockers")] + [TestCase("Star Wars: The Clone Wars", "Star+Wars+The+Clone+Wars")] + [TestCase("Hawaii Five-0", "Hawaii+Five+0")] + [TestCase("Franklin & Bash", "Franklin+and+Bash")] + [TestCase("Chicago P.D.", "Chicago+PD")] + [TestCase("Kourtney And Khlo\u00E9 Take The Hamptons", "Kourtney+And+Khloe+Take+The+Hamptons")] + public void should_replace_some_special_characters(string input, string expected) { Subject.SceneTitles = new List { input }; - return Subject.QueryTitles.First(); + Subject.QueryTitles.First().Should().Be(expected); } } } diff --git a/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs index 74b777028..e65d23a22 100644 --- a/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs +++ b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs @@ -9,6 +9,7 @@ using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.Categories; namespace NzbDrone.Core.Test.InstrumentationTests { @@ -68,6 +69,7 @@ namespace NzbDrone.Core.Test.InstrumentationTests [Test] [Explicit] + [ManualTest] public void perf_test() { MapRepository.Instance.EnableTraceLogging = false; diff --git a/src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs b/src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs index eefff220b..ca0e0825c 100644 --- a/src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs +++ b/src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs @@ -2,10 +2,12 @@ using NzbDrone.Core.Notifications.Prowl; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; +using NzbDrone.Test.Common.Categories; namespace NzbDrone.Core.Test.NotificationTests { [Explicit] + [ManualTest] [TestFixture] public class ProwlProviderTest : CoreTest { diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 42a3afe78..fa4a78235 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -72,9 +72,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True diff --git a/src/NzbDrone.Core.Test/packages.config b/src/NzbDrone.Core.Test/packages.config index 89dd04c74..34473bed5 100644 --- a/src/NzbDrone.Core.Test/packages.config +++ b/src/NzbDrone.Core.Test/packages.config @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs b/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs index 5096d27d0..e7fdeda65 100644 --- a/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs +++ b/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs @@ -8,7 +8,7 @@ using RestSharp; namespace NzbDrone.Integration.Test { [TestFixture] - [Ignore] + [Ignore("Command integration tests are bad, maybe?")] public class CommandIntegrationTest : IntegrationTest { [Test] diff --git a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj index 5310ead5a..81a41230b 100644 --- a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj @@ -80,9 +80,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True False diff --git a/src/NzbDrone.Integration.Test/packages.config b/src/NzbDrone.Integration.Test/packages.config index 4b2a513bf..510d7de04 100644 --- a/src/NzbDrone.Integration.Test/packages.config +++ b/src/NzbDrone.Integration.Test/packages.config @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj b/src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj index 0f71c9d46..f86f92765 100644 --- a/src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj +++ b/src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj @@ -50,9 +50,9 @@ False ..\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True @@ -95,4 +95,4 @@ --> - + \ No newline at end of file diff --git a/src/NzbDrone.Libraries.Test/packages.config b/src/NzbDrone.Libraries.Test/packages.config index b2a179849..05a869b49 100644 --- a/src/NzbDrone.Libraries.Test/packages.config +++ b/src/NzbDrone.Libraries.Test/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj index f63d07472..1c18d5e7a 100644 --- a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj @@ -62,9 +62,9 @@ False ..\Libraries\Mono.Posix.dll - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True @@ -120,4 +120,4 @@ --> - + \ No newline at end of file diff --git a/src/NzbDrone.Mono.Test/packages.config b/src/NzbDrone.Mono.Test/packages.config index 60c3e65b4..d6c314b16 100644 --- a/src/NzbDrone.Mono.Test/packages.config +++ b/src/NzbDrone.Mono.Test/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/NzbDrone.Test.Common/Categories/ManualTestAttribute.cs b/src/NzbDrone.Test.Common/Categories/ManualTestAttribute.cs new file mode 100644 index 000000000..37700203b --- /dev/null +++ b/src/NzbDrone.Test.Common/Categories/ManualTestAttribute.cs @@ -0,0 +1,13 @@ +using NUnit.Framework; + +namespace NzbDrone.Test.Common.Categories +{ + public class ManualTestAttribute : CategoryAttribute + { + public ManualTestAttribute() + : base("ManualTest") + { + + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Test.Common/LoggingTest.cs b/src/NzbDrone.Test.Common/LoggingTest.cs index 5e4acab88..2f34d29cc 100644 --- a/src/NzbDrone.Test.Common/LoggingTest.cs +++ b/src/NzbDrone.Test.Common/LoggingTest.cs @@ -3,6 +3,7 @@ using NLog; using NLog.Config; using NLog.Targets; using NUnit.Framework; +using NUnit.Framework.Interfaces; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; using NzbDrone.Common.Instrumentation; @@ -49,7 +50,7 @@ namespace NzbDrone.Test.Common { //can't use because of a bug in mono with 2.6.2, //https://bugs.launchpad.net/nunitv2/+bug/1076932 - if (BuildInfo.IsDebug && TestContext.CurrentContext.Result.State == TestState.Success) + if (BuildInfo.IsDebug && TestContext.CurrentContext.Result.Outcome == ResultState.Success) { ExceptionVerification.AssertNoUnexpectedLogs(); } diff --git a/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj b/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj index adbce2813..3d4fc81e0 100644 --- a/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj @@ -53,9 +53,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True False @@ -86,6 +86,7 @@ + diff --git a/src/NzbDrone.Test.Common/packages.config b/src/NzbDrone.Test.Common/packages.config index 72964194e..2620975fe 100644 --- a/src/NzbDrone.Test.Common/packages.config +++ b/src/NzbDrone.Test.Common/packages.config @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj b/src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj index e0eaf2704..0a4c98005 100644 --- a/src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj +++ b/src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj @@ -49,9 +49,9 @@ ..\packages\NLog.4.3.0-rc1\lib\net40\NLog.dll True - - False - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True diff --git a/src/NzbDrone.Update.Test/packages.config b/src/NzbDrone.Update.Test/packages.config index b2b405c63..ee0448a93 100644 --- a/src/NzbDrone.Update.Test/packages.config +++ b/src/NzbDrone.Update.Test/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj index af779531b..1f788057a 100644 --- a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj +++ b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj @@ -58,8 +58,9 @@ ..\packages\FluentAssertions.4.2.1\lib\net40\FluentAssertions.Core.dll True - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\packages\NUnit.3.2.0\lib\net40\nunit.framework.dll + True @@ -115,4 +116,4 @@ --> - + \ No newline at end of file diff --git a/src/NzbDrone.Windows.Test/packages.config b/src/NzbDrone.Windows.Test/packages.config index 60c3e65b4..d6c314b16 100644 --- a/src/NzbDrone.Windows.Test/packages.config +++ b/src/NzbDrone.Windows.Test/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/test.sh b/test.sh new file mode 100644 index 000000000..4a2f69e50 --- /dev/null +++ b/test.sh @@ -0,0 +1,44 @@ +PLATFORM=$1 +TYPE=$2 +WHERE="cat != ManualTest" +TEST_DIR="." +TEST_PATTERN="*Test.dll" +ASSEMBLIES="" + +if [ -d "$TEST_DIR/_tests" ]; then + TEST_DIR="$TEST_DIR/_tests" +fi + +NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.2.0/tools/nunit3-console.exe" +NUNIT_COMMAND="$NUNIT" +NUNIT_PARAMS="--teamcity" + +if [ "$PLATFORM" = "Windows" ]; then + WHERE="$WHERE && cat != LINUX" +elif [ "$PLATFORM" = "Linux" ]; then + WHERE="$WHERE && cat != WINDOWS" + NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT" +elif [ "$PLATFORM" = "Mac" ]; then + WHERE="$WHERE && cat != WINDOWS" + NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT" +else + echo "Platform must be provided as first arguement: Windows, Linux or Mac" + exit 1 +fi + +if [ "$TYPE" = "Unit" ]; then + WHERE="$WHERE && cat != IntegrationTest && cat != AutomationTest" +elif [ "$TYPE" = "Integration" ] || [ "$TYPE" = "int" ] ; then + WHERE="$WHERE && cat == IntegrationTest" +elif [ "$TYPE" = "Automation" ] ; then + WHERE="$WHERE && cat == AutomationTest" +else + echo "Type must be provided as second argument: Unit, Integration or Automation" + exit 2 +fi + +for i in `find $TEST_DIR -name "$TEST_PATTERN"`; + do ASSEMBLIES="$ASSEMBLIES $i" +done + +$NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES; diff --git a/tests_mono.sh b/tests_mono.sh deleted file mode 100644 index 52d9a5dfe..000000000 --- a/tests_mono.sh +++ /dev/null @@ -1,10 +0,0 @@ -EXCLUDE="-exclude:Windows,IntegrationTest" -TESTDIR="." -NUNIT="$TESTDIR/NUnit.Runners.2.6.1/tools/nunit-console-x86.exe" - -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Api.Result.xml $TESTDIR/NzbDrone.Api.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Common.Result.xml $TESTDIR/NzbDrone.Common.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Core.Result.xml $TESTDIR/NzbDrone.Core.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Host.Result.xml $TESTDIR/NzbDrone.Host.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Libraries.Result.xml $TESTDIR/NzbDrone.Libraries.Test.dll -mono --debug --runtime=v4.0 $NUNIT $EXCLUDE -xml:NzbDrone.Mono.Result.xml $TESTDIR/NzbDrone.Mono.Test.dll