diff --git a/NUnitConsole.sln b/NUnitConsole.sln index ad685967b..375b8a565 100644 --- a/NUnitConsole.sln +++ b/NUnitConsole.sln @@ -132,6 +132,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "zip", "zip", "{20005864-BE8 zip\nunit.bundle.addins = zip\nunit.bundle.addins EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine.core.tests", "src\NUnitEngine\nunit.engine.core.tests\nunit.engine.core.tests.csproj", "{CACC0520-B452-4310-A33C-DC944129ACDD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -182,6 +184,10 @@ Global {9D3015EE-5B84-41B3-A1D3-1A439370C392}.Debug|Any CPU.Build.0 = Debug|Any CPU {9D3015EE-5B84-41B3-A1D3-1A439370C392}.Release|Any CPU.ActiveCfg = Release|Any CPU {9D3015EE-5B84-41B3-A1D3-1A439370C392}.Release|Any CPU.Build.0 = Release|Any CPU + {CACC0520-B452-4310-A33C-DC944129ACDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CACC0520-B452-4310-A33C-DC944129ACDD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CACC0520-B452-4310-A33C-DC944129ACDD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CACC0520-B452-4310-A33C-DC944129ACDD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -207,6 +213,7 @@ Global {9BCA00E2-D072-424B-A6DF-5BECF719C1FB} = {49D441DF-39FD-4F4D-AECA-86CF8EFE23AF} {0C0D20CE-70CD-4CEF-BE9B-AEB8A2DE9C8A} = {49D441DF-39FD-4F4D-AECA-86CF8EFE23AF} {20005864-BE82-412D-99BF-288E2D8370E9} = {49D441DF-39FD-4F4D-AECA-86CF8EFE23AF} + {CACC0520-B452-4310-A33C-DC944129ACDD} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D8E4FC26-5422-4C51-8BBC-D1AC0A578711} diff --git a/build.cake b/build.cake index 16741229f..112b0125e 100644 --- a/build.cake +++ b/build.cake @@ -131,7 +131,7 @@ public void BuildUsingMSBuildOnWindowsOrMacOS() .WithProperty("TargetFramework", framework) .WithProperty("PublishDir", BIN_DIR + framework)); - foreach (var framework in new[] { "netcoreapp2.1", "netcoreapp3.1", "net5.0" }) + foreach (var framework in new[] { "netcoreapp2.1", "netcoreapp3.1" }) MSBuild(ENGINE_TESTS_PROJECT, CreateMSBuildSettings("Publish") .WithProperty("TargetFramework", framework) .WithProperty("PublishDir", BIN_DIR + framework)); @@ -154,7 +154,8 @@ private void BuildEachProjectSeparatelyOnLinux() BuildProject(AGENT_PROJECT, "net20", "net40", "netcoreapp3.1", "net5.0"); BuildProject(AGENT_X86_PROJECT, "net20", "net40"); - BuildProject(ENGINE_TESTS_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1", "net5.0"); + BuildProject(ENGINE_TESTS_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1"); + BuildProject(ENGINE_CORE_TESTS_PROJECT, "net35", "netcoreapp2.1", "netcoreapp3.1", "net5.0"); BuildProject(CONSOLE_TESTS_PROJECT, "net35", "netcoreapp3.1"); BuildProject(MOCK_ASSEMBLY_X86_PROJECT, "net35", "net40", "netcoreapp2.1", "netcoreapp3.1"); @@ -170,6 +171,9 @@ private void BuildEachProjectSeparatelyOnLinux() MSBuild(ENGINE_TESTS_PROJECT, CreateMSBuildSettings("Publish") .WithProperty("TargetFramework", "netcoreapp2.1") .WithProperty("PublishDir", BIN_DIR + "netcoreapp2.1")); + MSBuild(ENGINE_CORE_TESTS_PROJECT, CreateMSBuildSettings("Publish") + .WithProperty("TargetFramework", "netcoreapp2.1") + .WithProperty("PublishDir", BIN_DIR + "netcoreapp2.1")); } // NOTE: If we use DotNet to build on Linux, then our net35 projects fail. @@ -224,6 +228,82 @@ Task("CheckForTestErrors") .Description("Checks for errors running the test suites") .Does(() => DisplayUnreportedErrors()); +////////////////////////////////////////////////////////////////////// +// TEST .NET 2.0 ENGINE CORE +////////////////////////////////////////////////////////////////////// + +Task("TestNet20EngineCore") + .Description("Tests the engine core assembly") + .IsDependentOn("Build") + .OnError(exception => { UnreportedErrors.Add(exception.Message); }) + .Does(() => + { + RunTest( + NET20_CONSOLE, + BIN_DIR + "net35/", + ENGINE_CORE_TESTS, + "net35", + ref UnreportedErrors); + }); + +////////////////////////////////////////////////////////////////////// +// TEST NETSTANDARD 2.0 ENGINE CORE +////////////////////////////////////////////////////////////////////// + +Task("TestNetStandard20EngineCore") + .Description("Tests the .NET Standard Engine core assembly") + .IsDependentOn("Build") + .OnError(exception => { UnreportedErrors.Add(exception.Message); }) + .Does(() => + { + RunDotnetCoreNUnitLiteTests( + BIN_DIR + "netcoreapp2.1/" + ENGINE_CORE_TESTS, + BIN_DIR + "netcoreapp2.1", + "netcoreapp2.1", + ref UnreportedErrors); + }); + +////////////////////////////////////////////////////////////////////// +// TEST NETCORE 3.1 ENGINE CORE +////////////////////////////////////////////////////////////////////// + +Task("TestNetCore31EngineCore") + .Description("Tests the .NET Core 3.1 Engine core assembly") + .IsDependentOn("Build") + .OnError(exception => { UnreportedErrors.Add(exception.Message); }) + .Does(() => + { + var runtimes = new[] { "3.1", "5.0" }; + + foreach (var runtime in runtimes) + { + RunDotnetCoreTests( + NETCORE31_CONSOLE, + BIN_DIR + "netcoreapp3.1/", + ENGINE_CORE_TESTS, + runtime, + ref UnreportedErrors); + } + }); + +////////////////////////////////////////////////////////////////////// +// TEST NET 5.0 ENGINE CORE +////////////////////////////////////////////////////////////////////// + +Task("TestNet50EngineCore") + .Description("Tests the .NET 5.0 Engine core assembly") + .IsDependentOn("Build") + .OnError(exception => { UnreportedErrors.Add(exception.Message); }) + .Does(() => + { + RunDotnetCoreTests( + NETCORE31_CONSOLE, + BIN_DIR + "net5.0", + ENGINE_CORE_TESTS, + "net5.0", + ref UnreportedErrors); + }); + ////////////////////////////////////////////////////////////////////// // TEST .NET 2.0 ENGINE ////////////////////////////////////////////////////////////////////// @@ -238,7 +318,7 @@ Task("TestNet20Engine") NET20_CONSOLE, BIN_DIR + "net35/", ENGINE_TESTS, - "net35", + "net35", ref UnreportedErrors); }); @@ -715,14 +795,22 @@ Task("TestConsole") .IsDependentOn("TestNet20Console") .IsDependentOn("TestNetCore31Console"); +Task("TestEngineCore") + .Description("Builds and tests the engine core assembly") + .IsDependentOn("TestNet20EngineCore") + .IsDependentOn("TestNetStandard20EngineCore") + .IsDependentOn("TestNetCore31EngineCore") + .IsDependentOn("TestNet50EngineCore"); + Task("TestEngine") - .Description("Builds and tests the engine") + .Description("Builds and tests the engine assembly") .IsDependentOn("TestNet20Engine") .IsDependentOn("TestNetStandard20Engine") .IsDependentOn("TestNetCore31Engine"); Task("Test") .Description("Builds and tests the engine and console runner") + .IsDependentOn("TestEngineCore") .IsDependentOn("TestEngine") .IsDependentOn("TestConsole") .IsDependentOn("CheckForTestErrors"); diff --git a/cake/constants.cake b/cake/constants.cake index 18ba79d54..f9aef65b6 100644 --- a/cake/constants.cake +++ b/cake/constants.cake @@ -30,6 +30,7 @@ var AGENT_X86_PROJECT = SOURCE_DIR + "NUnitEngine/nunit-agent-x86/nunit-agent-x8 var ENGINE_API_PROJECT = SOURCE_DIR + "NUnitEngine/nunit.engine.api/nunit.engine.api.csproj"; var ENGINE_CORE_PROJECT = SOURCE_DIR + "NUnitEngine/nunit.engine.core/nunit.engine.core.csproj"; var ENGINE_TESTS_PROJECT = SOURCE_DIR + "NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj"; +var ENGINE_CORE_TESTS_PROJECT = SOURCE_DIR + "NUnitEngine/nunit.engine.core.tests/nunit.engine.core.tests.csproj"; var CONSOLE_PROJECT = SOURCE_DIR + "NUnitConsole/nunit3-console/nunit3-console.csproj"; var CONSOLE_TESTS_PROJECT = SOURCE_DIR + "NUnitConsole/nunit3-console.tests/nunit3-console.tests.csproj"; var MOCK_ASSEMBLY_PROJECT = SOURCE_DIR + "NUnitEngine/mock-assembly/mock-assembly.csproj"; @@ -38,7 +39,8 @@ var NOTEST_PROJECT = SOURCE_DIR + "NUnitEngine/notest-assembly/notest-assembly.c // Console Runner var NET20_CONSOLE = BIN_DIR + "net20/nunit3-console.exe"; var NETCORE31_CONSOLE = BIN_DIR + "netcoreapp3.1/nunit3-console.dll"; -// Unit Tests +// Test Assemblies +var ENGINE_CORE_TESTS = "nunit.engine.core.tests.dll"; var ENGINE_TESTS = "nunit.engine.tests.dll"; var CONSOLE_TESTS = "nunit3-console.tests.dll"; diff --git a/cake/package-definitions.cake b/cake/package-definitions.cake index d58e13aef..95dfdc1da 100644 --- a/cake/package-definitions.cake +++ b/cake/package-definitions.cake @@ -129,9 +129,10 @@ public void InitializePackageDefinitions(ICakeContext context) HasDirectory("bin/netstandard2.0").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES), HasDirectory("bin/netcoreapp2.1").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES), HasDirectory("bin/netcoreapp3.1").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES), - HasDirectory("bin/net5.0").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES), + //HasDirectory("bin/net5.0").WithFiles(ENGINE_FILES).AndFiles(ENGINE_PDB_FILES), HasDirectory("bin/agents/net20").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES), - HasDirectory("bin/agents/net40").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES) + HasDirectory("bin/agents/net40").WithFiles(AGENT_FILES).AndFiles(AGENT_PDB_FILES), + HasDirectory("bin/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFiles(AGENT_PDB_FILES_NETCORE), }, executable: "bin/net20/nunit3-console.exe", tests: StandardRunnerTests.Concat(new[] { NUnitProjectTest })), diff --git a/src/NUnitEngine/nunit.engine.tests/App.config b/src/NUnitEngine/nunit.engine.core.tests/App.config similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/App.config rename to src/NUnitEngine/nunit.engine.core.tests/App.config diff --git a/src/NUnitEngine/nunit.engine.tests/AsyncTestEngineResultTests.cs b/src/NUnitEngine/nunit.engine.core.tests/AsyncTestEngineResultTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/AsyncTestEngineResultTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/AsyncTestEngineResultTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Drivers/NUnit3FrameworkDriverTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Drivers/NUnit3FrameworkDriverTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Drivers/NUnit3FrameworkDriverTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Drivers/NUnit3FrameworkDriverTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Drivers/NUnitNetStandardDriverTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Drivers/NUnitNetStandardDriverTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Drivers/NUnitNetStandardDriverTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Drivers/NUnitNetStandardDriverTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Drivers/NotRunnableFrameworkDriverTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Drivers/NotRunnableFrameworkDriverTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Drivers/NotRunnableFrameworkDriverTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Drivers/NotRunnableFrameworkDriverTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/DummyExtensions.cs b/src/NUnitEngine/nunit.engine.core.tests/DummyExtensions.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/DummyExtensions.cs rename to src/NUnitEngine/nunit.engine.core.tests/DummyExtensions.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Extensibility/ExtensionAssemblyTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Extensibility/ExtensionAssemblyTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Extensibility/ExtensionAssemblyTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Extensibility/ExtensionAssemblyTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Extensibility/ExtensionSelectorTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Extensibility/ExtensionSelectorTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Extensibility/ExtensionSelectorTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Extensibility/ExtensionSelectorTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Helpers/On.cs b/src/NUnitEngine/nunit.engine.core.tests/Helpers/On.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Helpers/On.cs rename to src/NUnitEngine/nunit.engine.core.tests/Helpers/On.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/AddinsFileReaderTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/AddinsFileReaderTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/AddinsFileReaderTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/AddinsFileReaderTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/AddinsFileReaderTests2.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/AddinsFileReaderTests2.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/AddinsFileReaderTests2.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/AddinsFileReaderTests2.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/AssemblyHelperTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/AssemblyHelperTests.cs similarity index 99% rename from src/NUnitEngine/nunit.engine.tests/Internal/AssemblyHelperTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/AssemblyHelperTests.cs index 9ea9f588e..280b400fb 100644 --- a/src/NUnitEngine/nunit.engine.tests/Internal/AssemblyHelperTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Internal/AssemblyHelperTests.cs @@ -8,7 +8,7 @@ namespace NUnit.Engine.Internal.Tests [TestFixture] public class AssemblyHelperTests { - private static readonly string THIS_ASSEMBLY_PATH = "nunit.engine.tests.dll"; + private static readonly string THIS_ASSEMBLY_PATH = "nunit.engine.core.tests.dll"; [Test] public void GetPathForAssembly() diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/Backports/PathTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/Backports/PathTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/Backports/PathTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/Backports/PathTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/Backports/TupleTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/Backports/TupleTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/Backports/TupleTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/Backports/TupleTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/DirectoryFinderTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/DirectoryFinderTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/DirectoryFinderTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/DirectoryFinderTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/DirectoryTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/DirectoryTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/DirectoryTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/DirectoryTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/DirectoryTests2.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/DirectoryTests2.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/DirectoryTests2.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/DirectoryTests2.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/FileSystemTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/FileSystemTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/FileSystemTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/FileSystemTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/FileTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/FileTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/FileSystemAccess/Default/FileTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/FileSystemAccess/Default/FileTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/PathUtilTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/PathUtilTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/PathUtilTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/PathUtilTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/ProcessUtilsTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/ProcessUtilsTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/ProcessUtilsTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/ProcessUtilsTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Internal/TcpChannelUtilsTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Internal/TcpChannelUtilsTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Internal/TcpChannelUtilsTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Internal/TcpChannelUtilsTests.cs diff --git a/src/NUnitEngine/nunit.engine.core.tests/Program.cs b/src/NUnitEngine/nunit.engine.core.tests/Program.cs new file mode 100644 index 000000000..fb99ccf93 --- /dev/null +++ b/src/NUnitEngine/nunit.engine.core.tests/Program.cs @@ -0,0 +1,17 @@ +// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt + +#if !NET35 +using System.Reflection; +using NUnitLite; + +namespace NUnit.Engine.Tests +{ + class Program + { + static int Main(string[] args) + { + return new TextRunner(typeof(Program).GetTypeInfo().Assembly).Execute(args); + } + } +} +#endif \ No newline at end of file diff --git a/src/NUnitEngine/nunit.engine.tests/ResultHelperTests.cs b/src/NUnitEngine/nunit.engine.core.tests/ResultHelperTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/ResultHelperTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/ResultHelperTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Runners/DirectTestRunnerTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Runners/DirectTestRunnerTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Runners/DirectTestRunnerTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Runners/DirectTestRunnerTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Runners/Fakes/EmptyDirectTestRunner.cs b/src/NUnitEngine/nunit.engine.core.tests/Runners/Fakes/EmptyDirectTestRunner.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Runners/Fakes/EmptyDirectTestRunner.cs rename to src/NUnitEngine/nunit.engine.core.tests/Runners/Fakes/EmptyDirectTestRunner.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Runners/ParallelTaskWorkerPoolTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Runners/ParallelTaskWorkerPoolTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Runners/ParallelTaskWorkerPoolTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Runners/ParallelTaskWorkerPoolTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Runners/TestEngineRunnerTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Runners/TestEngineRunnerTests.cs similarity index 92% rename from src/NUnitEngine/nunit.engine.tests/Runners/TestEngineRunnerTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Runners/TestEngineRunnerTests.cs index d26ed5031..19622ccd9 100644 --- a/src/NUnitEngine/nunit.engine.tests/Runners/TestEngineRunnerTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Runners/TestEngineRunnerTests.cs @@ -47,14 +47,10 @@ public void Initialize() // Add all services needed by any of our TestEngineRunners _services = new ServiceContext(); _services.Add(new Services.ExtensionService()); - _services.Add(new Services.ProjectService()); #if NETFRAMEWORK _services.Add(new Services.DomainManager()); - _services.Add(new Services.RuntimeFrameworkService()); - _services.Add(new Services.TestAgency()); #endif _services.Add(new Services.DriverService()); - _services.Add(new Services.DefaultTestRunnerFactory()); _services.ServiceManager.StartServices(); var mockAssemblyPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "mock-assembly.dll"); @@ -115,10 +111,11 @@ public void Run() [Test] public void RunAsync() { -#if NETFRAMEWORK - if (_runner is ProcessRunner || _runner is MultipleTestProcessRunner) - Assert.Ignore("RunAsync is not working for ProcessRunner"); -#endif +// TODO +//#if NETFRAMEWORK +// if (_runner is ProcessRunner || _runner is MultipleTestProcessRunner) +// Assert.Ignore("RunAsync is not working for ProcessRunner"); +//#endif var asyncResult = _runner.RunAsync(null, TestFilter.Empty); asyncResult.Wait(-1); diff --git a/src/NUnitEngine/nunit.engine.tests/RuntimeFrameworkTests.cs b/src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/RuntimeFrameworkTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Services/DomainManagerStaticTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/DomainManagerStaticTests.cs similarity index 98% rename from src/NUnitEngine/nunit.engine.tests/Services/DomainManagerStaticTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/DomainManagerStaticTests.cs index ebb5d8b72..537e05784 100644 --- a/src/NUnitEngine/nunit.engine.tests/Services/DomainManagerStaticTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/DomainManagerStaticTests.cs @@ -15,7 +15,7 @@ public static class DomainManagerStaticTests static string path2 = TestPath("/test/bin/debug/test2.dll"); static string path3 = TestPath("/test/utils/test3.dll"); - const string STANDARD_CONFIG_FILE = "nunit.engine.tests.dll.config"; + const string STANDARD_CONFIG_FILE = "nunit.engine.core.tests.dll.config"; const string ALTERNATE_CONFIG_FILE = "alt.config"; [Test] diff --git a/src/NUnitEngine/nunit.engine.tests/Services/DomainManagerTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/DomainManagerTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/Services/DomainManagerTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/DomainManagerTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/Services/DriverServiceTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/DriverServiceTests.cs similarity index 89% rename from src/NUnitEngine/nunit.engine.tests/Services/DriverServiceTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/DriverServiceTests.cs index e45f27349..811b769d6 100644 --- a/src/NUnitEngine/nunit.engine.tests/Services/DriverServiceTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/DriverServiceTests.cs @@ -31,7 +31,11 @@ public void ServiceIsStarted() } -#if NETCOREAPP3_1_OR_GREATER +#if NET5_0_OR_GREATER + [TestCase("mock-assembly.dll", false, typeof(NUnitNetCore31Driver))] + [TestCase("mock-assembly.dll", true, typeof(NUnitNetCore31Driver))] + //[TestCase("notest-assembly.dll", false, typeof(NUnitNetCore31Driver))] +#elif NETCOREAPP3_1 [TestCase("mock-assembly.dll", false, typeof(NUnitNetCore31Driver))] [TestCase("mock-assembly.dll", true, typeof(NUnitNetCore31Driver))] [TestCase("notest-assembly.dll", false, typeof(NUnitNetCore31Driver))] @@ -49,8 +53,10 @@ public void ServiceIsStarted() [TestCase("junk.dll", false, typeof(InvalidAssemblyFrameworkDriver))] [TestCase("junk.dll", true, typeof(InvalidAssemblyFrameworkDriver))] [TestCase("nunit.engine.dll", false, typeof(InvalidAssemblyFrameworkDriver))] +#if !NET5_0 // Not yet working [TestCase("nunit.engine.dll", true, typeof(SkippedAssemblyFrameworkDriver))] [TestCase("notest-assembly.dll", true, typeof(SkippedAssemblyFrameworkDriver))] +#endif public void CorrectDriverIsUsed(string fileName, bool skipNonTestAssemblies, Type expectedType) { var driver = _driverService.GetDriver(AppDomain.CurrentDomain, Path.Combine(TestContext.CurrentContext.TestDirectory, fileName), null, skipNonTestAssemblies); diff --git a/src/NUnitEngine/nunit.engine.tests/Services/ExtensionServiceTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/ExtensionServiceTests.cs similarity index 99% rename from src/NUnitEngine/nunit.engine.tests/Services/ExtensionServiceTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/ExtensionServiceTests.cs index d4122ad22..db6fdbc37 100644 --- a/src/NUnitEngine/nunit.engine.tests/Services/ExtensionServiceTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/ExtensionServiceTests.cs @@ -48,7 +48,6 @@ public void CreateService() // Rather than actually starting the service, which would result // in finding the extensions actually in use on the current system, // we simulate the start using this assemblies dummy extensions. - _serviceClass.FindExtensionPoints(typeof(TestEngine).Assembly); _serviceClass.FindExtensionPoints(typeof(CoreEngine).Assembly); _serviceClass.FindExtensionPoints(typeof(ITestEngine).Assembly); @@ -159,7 +158,7 @@ public void SkipsGracefullyLoadingOtherFrameworkExtensionAssembly() Assert.That(assemblyName, Does.Exist); var service = new ExtensionService(); - service.FindExtensionPoints(typeof(TestEngine).Assembly); + service.FindExtensionPoints(typeof(CoreEngine).Assembly); service.FindExtensionPoints(typeof(ITestEngine).Assembly); var extensionAssembly = new ExtensionAssembly(assemblyName, false); diff --git a/src/NUnitEngine/nunit.engine.core.tests/Services/Fakes/FakeService.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/Fakes/FakeService.cs new file mode 100644 index 000000000..cdad7ac19 --- /dev/null +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/Fakes/FakeService.cs @@ -0,0 +1,38 @@ +// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt + +using System; + +namespace NUnit.Engine.Services.Tests.Fakes +{ + interface IFakeService + { } + + public class FakeService : IFakeService, IService + { + IServiceLocator IService.ServiceContext { get; set; } + + private ServiceStatus _status; + ServiceStatus IService.Status + { + get { return _status; } + } + + void IService.StartService() + { + _status = FailToStart + ? ServiceStatus.Error + : ServiceStatus.Started; + } + + void IService.StopService() + { + _status = ServiceStatus.Stopped; + if (FailedToStop) + throw new ArgumentException(nameof(FailedToStop)); + } + + public bool FailToStart { get; set; } + + public bool FailedToStop { get; set; } + } +} diff --git a/src/NUnitEngine/nunit.engine.tests/Services/InProcessTestRunnerFactoryTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/InProcessTestRunnerFactoryTests.cs similarity index 99% rename from src/NUnitEngine/nunit.engine.tests/Services/InProcessTestRunnerFactoryTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/InProcessTestRunnerFactoryTests.cs index 6c3fbbf76..d0ca443e7 100644 --- a/src/NUnitEngine/nunit.engine.tests/Services/InProcessTestRunnerFactoryTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/InProcessTestRunnerFactoryTests.cs @@ -8,8 +8,6 @@ namespace NUnit.Engine.Services.Tests { - using Fakes; - public class InProcessTestRunnerFactoryTests { private InProcessTestRunnerFactory _factory; diff --git a/src/NUnitEngine/nunit.engine.tests/Services/ServiceManagerTests.cs b/src/NUnitEngine/nunit.engine.core.tests/Services/ServiceManagerTests.cs similarity index 63% rename from src/NUnitEngine/nunit.engine.tests/Services/ServiceManagerTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/Services/ServiceManagerTests.cs index 0fbea9f9e..4dc8d9352 100644 --- a/src/NUnitEngine/nunit.engine.tests/Services/ServiceManagerTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/Services/ServiceManagerTests.cs @@ -9,21 +9,21 @@ namespace NUnit.Engine.Services.Tests public class ServiceManagerTests { - private IService _settingsService; + private IService _fakeService; private ServiceManager _serviceManager; - private IService _projectService; + private IService _extensionService; [SetUp] public void SetUp() { _serviceManager = new ServiceManager(); - _settingsService = new FakeSettingsService(); - _serviceManager.AddService(_settingsService); + _fakeService = new FakeService(); + _serviceManager.AddService(_fakeService); - _projectService = new Fakes.FakeProjectService(); - _serviceManager.AddService(_projectService); + _extensionService = new ExtensionService(); + _serviceManager.AddService(_extensionService); } [Test] @@ -31,25 +31,25 @@ public void InitializeServices() { _serviceManager.StartServices(); - IService service = _serviceManager.GetService(typeof(ISettings)); + IService service = _serviceManager.GetService(typeof(IFakeService)); Assert.That(service.Status, Is.EqualTo(ServiceStatus.Started)); - service = _serviceManager.GetService(typeof(IProjectService)); + service = _serviceManager.GetService(typeof(IExtensionService)); Assert.That(service.Status, Is.EqualTo(ServiceStatus.Started)); } [Test] public void InitializationFailure() { - ((FakeSettingsService)_settingsService).FailToStart = true; + ((FakeService)_fakeService).FailToStart = true; Assert.That(() => _serviceManager.StartServices(), - Throws.InstanceOf().And.Message.Contains("FakeSettingsService")); + Throws.InstanceOf().And.Message.Contains("FakeService")); } [Test] public void TerminationFailure() { - ((FakeSettingsService)_settingsService).FailedToStop = true; - _settingsService.StartService(); + ((FakeService)_fakeService).FailedToStop = true; + _fakeService.StartService(); Assert.DoesNotThrow(() => _serviceManager.StopServices()); } @@ -57,15 +57,15 @@ public void TerminationFailure() [Test] public void AccessServiceByClass() { - IService service = _serviceManager.GetService(typeof(FakeSettingsService)); - Assert.That(service, Is.SameAs(_settingsService)); + IService service = _serviceManager.GetService(typeof(FakeService)); + Assert.That(service, Is.SameAs(_fakeService)); } [Test] public void AccessServiceByInterface() { - IService service = _serviceManager.GetService(typeof(ISettings)); - Assert.That(service, Is.SameAs(_settingsService)); + IService service = _serviceManager.GetService(typeof(IFakeService)); + Assert.That(service, Is.SameAs(_fakeService)); } } } diff --git a/src/NUnitEngine/nunit.engine.tests/TestEngineResultTests.cs b/src/NUnitEngine/nunit.engine.core.tests/TestEngineResultTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/TestEngineResultTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/TestEngineResultTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/XmlHelperTests.cs b/src/NUnitEngine/nunit.engine.core.tests/XmlHelperTests.cs similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/XmlHelperTests.cs rename to src/NUnitEngine/nunit.engine.core.tests/XmlHelperTests.cs diff --git a/src/NUnitEngine/nunit.engine.tests/alt.config b/src/NUnitEngine/nunit.engine.core.tests/alt.config similarity index 100% rename from src/NUnitEngine/nunit.engine.tests/alt.config rename to src/NUnitEngine/nunit.engine.core.tests/alt.config diff --git a/src/NUnitEngine/nunit.engine.core.tests/nunit.engine.core.tests.csproj b/src/NUnitEngine/nunit.engine.core.tests/nunit.engine.core.tests.csproj new file mode 100644 index 000000000..5cbb87e3d --- /dev/null +++ b/src/NUnitEngine/nunit.engine.core.tests/nunit.engine.core.tests.csproj @@ -0,0 +1,38 @@ + + + NUnit.Engine.Core.Tests + net35;netcoreapp2.1;netcoreapp3.1;net5.0 + Exe + true + ..\..\nunit.snk + Full + false + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + \ No newline at end of file diff --git a/src/NUnitEngine/nunit.engine.core/Properties/AssemblyInfo.cs b/src/NUnitEngine/nunit.engine.core/Properties/AssemblyInfo.cs index 2f3f43e40..a0427c29f 100644 --- a/src/NUnitEngine/nunit.engine.core/Properties/AssemblyInfo.cs +++ b/src/NUnitEngine/nunit.engine.core/Properties/AssemblyInfo.cs @@ -13,7 +13,7 @@ // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: InternalsVisibleTo("nunit.engine.tests, PublicKey="+ +[assembly: InternalsVisibleTo("nunit.engine.core.tests, PublicKey=" + "002400000480000094000000060200000024000052534131000400000100010031eea370b1984b" + "fa6d1ea760e1ca6065cee41a1a279ca234933fe977a096222c0e14f9e5a17d5689305c6d7f1206"+ "a85a53c48ca010080799d6eeef61c98abd18767827dc05daea6b6fbd2e868410d9bee5e972a004"+ diff --git a/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj b/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj index 021ed20c8..c106bec08 100644 --- a/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj +++ b/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj @@ -1,7 +1,7 @@  NUnit.Engine.Tests - net35;netcoreapp2.1;netcoreapp3.1;net5.0 + net35;netcoreapp2.1;netcoreapp3.1 Exe true ..\..\nunit.snk @@ -17,7 +17,7 @@ - + @@ -27,7 +27,6 @@ - @@ -43,15 +42,5 @@ PreserveNewest - - PreserveNewest - - - - - - - - \ No newline at end of file