diff --git a/MixedTests.nunit b/MixedTests.nunit index 9c26ee71b..d183fad2b 100644 --- a/MixedTests.nunit +++ b/MixedTests.nunit @@ -1,5 +1,5 @@  - + diff --git a/NUnitConsole.sln b/NUnitConsole.sln index 3596ab362..95a3d2ac5 100644 --- a/NUnitConsole.sln +++ b/NUnitConsole.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 18 -VisualStudioVersion = 18.7.11919.86 stable +VisualStudioVersion = 18.7.11919.86 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{49D441DF-39FD-4F4D-AECA-86CF8EFE23AF}" ProjectSection(SolutionItems) = preProject @@ -42,8 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NUnitEngine", "NUnitEngine" src\NUnitEngine\Directory.Build.props = src\NUnitEngine\Directory.Build.props EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine.api", "src\NUnitEngine\nunit.engine.api\nunit.engine.api.csproj", "{775FAD50-3623-4922-97C4-DFB29A8BE4C7}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine", "src\NUnitEngine\nunit.engine\nunit.engine.csproj", "{372A3447-D657-40FF-A089-77C19FEC30C8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine.tests", "src\NUnitEngine\nunit.engine.tests\nunit.engine.tests.csproj", "{D694CB69-6CFB-4762-86C2-EB27B808B282}" @@ -161,10 +159,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {775FAD50-3623-4922-97C4-DFB29A8BE4C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {775FAD50-3623-4922-97C4-DFB29A8BE4C7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {775FAD50-3623-4922-97C4-DFB29A8BE4C7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {775FAD50-3623-4922-97C4-DFB29A8BE4C7}.Release|Any CPU.Build.0 = Release|Any CPU {372A3447-D657-40FF-A089-77C19FEC30C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {372A3447-D657-40FF-A089-77C19FEC30C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {372A3447-D657-40FF-A089-77C19FEC30C8}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -279,7 +273,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {A972031D-2F61-4183-AF75-99EE1A9F6B32} = {49D441DF-39FD-4F4D-AECA-86CF8EFE23AF} - {775FAD50-3623-4922-97C4-DFB29A8BE4C7} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39} {372A3447-D657-40FF-A089-77C19FEC30C8} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39} {D694CB69-6CFB-4762-86C2-EB27B808B282} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39} {F3E87D0F-6F06-4C0B-AE06-42C0834C3C6E} = {A972031D-2F61-4183-AF75-99EE1A9F6B32} diff --git a/build.cake b/build.cake index 2aa9ad6da..834388aac 100644 --- a/build.cake +++ b/build.cake @@ -38,20 +38,6 @@ PackageDefinition NUnitExtensibilityApiPackage = new NuGetPackage( HasDirectory("lib/netstandard2.0").WithFile("nunit.extensibility.api.pdb") }); -PackageDefinition NUnitEngineApiPackage = new NuGetPackage( - id: "NUnit.Engine.Api", - source: BuildSettings.SourceDirectory + "NUnitEngine/nunit.engine.api/nunit.engine.api.csproj", - checks: new PackageCheck[] { - HasFile("LICENSE.txt"), - HasDirectory("lib/net462").WithFile("nunit.engine.api.dll"), - HasDirectory("lib/netstandard2.0").WithFile("nunit.engine.api.dll"), - HasDependency("NUnit.Extensibility.Api", THIS_VERSION) - }, - symbols: new PackageCheck[] { - HasDirectory("lib/net462").WithFile("nunit.engine.api.pdb"), - HasDirectory("lib/netstandard2.0").WithFile("nunit.engine.api.pdb") - }); - PackageDefinition NUnitCommonPackage = new NuGetPackage( id: "NUnit.Common", source: BuildSettings.SourceDirectory + "NUnitCommon/nunit.common/nunit.common.csproj", @@ -60,7 +46,7 @@ PackageDefinition NUnitCommonPackage = new NuGetPackage( HasFile("LICENSE.txt"), HasDirectory("lib/net462").WithFile("nunit.common.dll"), HasDirectory("lib/netstandard2.0").WithFile("nunit.common.dll"), - HasDependency("NUnit.Engine.Api", THIS_VERSION) + HasDependency("NUnit.Engine.Api") }, symbols: new PackageCheck[] { @@ -77,7 +63,7 @@ PackageDefinition NUnitExtensibilityPackage = new NuGetPackage( HasDirectory("lib/net462").WithFile("nunit.extensibility.dll"), HasDirectory("lib/netstandard2.0").WithFile("nunit.extensibility.dll"), HasDependency("NUnit.Extensibility.Api", THIS_VERSION), - HasDependency("NUnit.Engine.Api", THIS_VERSION), + HasDependency("NUnit.Engine.Api"), HasDependency("NUnit.Common", THIS_VERSION), HasDependency("TestCentric.Metadata", "3.0.4") }, @@ -95,7 +81,7 @@ PackageDefinition NUnitAgentCorePackage = new NuGetPackage( HasFiles("LICENSE.txt"), HasDirectory("lib/net462").WithFile("nunit.agent.core.dll" ), HasDirectory("lib/net8.0").WithFiles("nunit.agent.core.dll"), - HasDependency("NUnit.Engine.Api", THIS_VERSION), + HasDependency("NUnit.Engine.Api"), HasDependency("NUnit.Common", THIS_VERSION), HasDependency("TestCentric.Metadata", "3.0.4") }, @@ -115,7 +101,7 @@ PackageDefinition NUnitEnginePackage = new NuGetPackage( HasFiles("LICENSE.txt"), HasDirectory("lib/net462").WithFile("nunit.engine.dll"), HasDirectory("lib/net8.0").WithFile("nunit.engine.dll"), - HasDependency("NUnit.Engine.Api", THIS_VERSION), + HasDependency("NUnit.Engine.Api"), HasDependency("NUnit.Common", THIS_VERSION), HasDependency("NUnit.Extensibility", THIS_VERSION) }, @@ -156,7 +142,7 @@ PackageDefinition NUnitConsoleRunnerNuGetPackage = new NuGetPackage( new DirectoryContent("tools").WithFiles( "net462/nunit-console.exe", "net462/nunit-console.exe.config", "net462/nunit.engine.dll", "net462/nunit.extensibility.dll", "net462/nunit.extensibility.api.dll", "net462/nunit.common.dll", - "net462/nunit-console.pdb", "net462/nunit.engine.pdb", "net462/nunit.engine.api.pdb", + "net462/nunit-console.pdb", "net462/nunit.engine.pdb", "net462/nunit.extensibility.pdb", "net462/nunit.extensibility.api.pdb", "net462/nunit.common.pdb", "net462/nunit.engine.api.dll", "net462/testcentric.metadata.dll")) .WithDependencies(KnownExtensions.BundledNuGetAgents), @@ -179,7 +165,6 @@ PackageDefinition NUnitConsoleNuGetPackage = new NuGetPackage( // Dependencies must precede all the packages that depend on them. BuildSettings.Packages.AddRange(new PackageDefinition[] { NUnitExtensibilityApiPackage, - NUnitEngineApiPackage, NUnitCommonPackage, NUnitExtensibilityPackage, NUnitAgentCorePackage, diff --git a/nuget/runners/nunit.console-runner.nuspec b/nuget/runners/nunit.console-runner.nuspec index 27193c5a4..f68497a7b 100644 --- a/nuget/runners/nunit.console-runner.nuspec +++ b/nuget/runners/nunit.console-runner.nuspec @@ -36,7 +36,6 @@ - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 4fa4405b7..b4fcc8cef 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,6 +22,7 @@ true 8.0.0 + 4.0.0-beta.3 NUnit Software NUnit 4 Runner and Engine diff --git a/src/NUnitCommon/DirectTestAgent/DirectTestAgent.csproj b/src/NUnitCommon/DirectTestAgent/DirectTestAgent.csproj index e3a854a22..ea99841eb 100644 --- a/src/NUnitCommon/DirectTestAgent/DirectTestAgent.csproj +++ b/src/NUnitCommon/DirectTestAgent/DirectTestAgent.csproj @@ -8,13 +8,16 @@ false - - + - + + + + + diff --git a/src/NUnitCommon/nunit.agent.core/nunit.agent.core.csproj b/src/NUnitCommon/nunit.agent.core/nunit.agent.core.csproj index 9c3c49e43..0198b25ac 100644 --- a/src/NUnitCommon/nunit.agent.core/nunit.agent.core.csproj +++ b/src/NUnitCommon/nunit.agent.core/nunit.agent.core.csproj @@ -21,7 +21,6 @@ - @@ -35,6 +34,7 @@ + diff --git a/src/NUnitCommon/nunit.common.tests/nunit.common.tests.csproj b/src/NUnitCommon/nunit.common.tests/nunit.common.tests.csproj index 2d86176ec..46f2b9d5e 100644 --- a/src/NUnitCommon/nunit.common.tests/nunit.common.tests.csproj +++ b/src/NUnitCommon/nunit.common.tests/nunit.common.tests.csproj @@ -10,7 +10,6 @@ - diff --git a/src/NUnitCommon/nunit.common/nunit.common.csproj b/src/NUnitCommon/nunit.common/nunit.common.csproj index 6989cadde..a9a005fda 100644 --- a/src/NUnitCommon/nunit.common/nunit.common.csproj +++ b/src/NUnitCommon/nunit.common/nunit.common.csproj @@ -21,7 +21,7 @@ - + diff --git a/src/NUnitCommon/nunit.extensibility.tests/nunit.extensibility.tests.csproj b/src/NUnitCommon/nunit.extensibility.tests/nunit.extensibility.tests.csproj index a6e33cae0..2d38735ea 100644 --- a/src/NUnitCommon/nunit.extensibility.tests/nunit.extensibility.tests.csproj +++ b/src/NUnitCommon/nunit.extensibility.tests/nunit.extensibility.tests.csproj @@ -14,7 +14,6 @@ - diff --git a/src/NUnitCommon/nunit.extensibility/nunit.extensibility.csproj b/src/NUnitCommon/nunit.extensibility/nunit.extensibility.csproj index a7866eeb3..1c310f328 100644 --- a/src/NUnitCommon/nunit.extensibility/nunit.extensibility.csproj +++ b/src/NUnitCommon/nunit.extensibility/nunit.extensibility.csproj @@ -13,11 +13,11 @@ + - diff --git a/src/NUnitConsole/nunit4-console.tests/nunit4-console.tests.csproj b/src/NUnitConsole/nunit4-console.tests/nunit4-console.tests.csproj index bc046380b..deb5b9a08 100644 --- a/src/NUnitConsole/nunit4-console.tests/nunit4-console.tests.csproj +++ b/src/NUnitConsole/nunit4-console.tests/nunit4-console.tests.csproj @@ -42,7 +42,6 @@ - diff --git a/src/NUnitConsole/nunit4-console/nunit4-console.csproj b/src/NUnitConsole/nunit4-console/nunit4-console.csproj index 57157f50b..f5db54285 100644 --- a/src/NUnitConsole/nunit4-console/nunit4-console.csproj +++ b/src/NUnitConsole/nunit4-console/nunit4-console.csproj @@ -28,7 +28,6 @@ - diff --git a/src/NUnitConsole/nunit4-netcore-console/nunit4-netcore-console.csproj b/src/NUnitConsole/nunit4-netcore-console/nunit4-netcore-console.csproj index a259b73af..ce14fed6d 100644 --- a/src/NUnitConsole/nunit4-netcore-console/nunit4-netcore-console.csproj +++ b/src/NUnitConsole/nunit4-netcore-console/nunit4-netcore-console.csproj @@ -62,7 +62,6 @@ - diff --git a/src/NUnitEngine/nunit.engine.api/AsyncTestEngineResult.cs b/src/NUnitEngine/nunit.engine.api/AsyncTestEngineResult.cs deleted file mode 100644 index e1d475c7c..000000000 --- a/src/NUnitEngine/nunit.engine.api/AsyncTestEngineResult.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Threading; -using System.Xml; - -namespace NUnit.Engine -{ - /// - /// The TestRun class encapsulates an ongoing test run. - /// - [Serializable] - public class AsyncTestEngineResult : ITestRun - { - private volatile TestEngineResult? _result; - private readonly ManualResetEvent _waitHandle = new ManualResetEvent(false); - - /// - /// Get the result of this run. - /// - /// Cannot retrieve Result from an incomplete or cancelled TestRun. - public TestEngineResult EngineResult - { - get - { - if (_result is null) - throw new InvalidOperationException("Cannot retrieve Result from an incomplete or cancelled TestRun."); - - return _result; - } - } - - /// - /// TODO: Can we remove this? - /// - public EventWaitHandle WaitHandle - { - get { return _waitHandle; } - } - - /// - /// Used by tests - /// - public void SetResult(TestEngineResult result) - { - if (result is null) - throw new ArgumentNullException(nameof(result)); - if (_result is not null) - throw new InvalidOperationException("Cannot set the Result of an TestRun more than once"); - - _result = result; - _waitHandle.Set(); - } - - /// - /// Blocks the current thread until the current test run completes - /// or the timeout is reached - /// - /// A that represents the number of milliseconds to wait, or -1 milliseconds to wait indefinitely. - /// True if the run completed - public bool Wait(int timeout) - { - return _waitHandle.WaitOne(timeout); - } - - /// - /// True if the test run has completed - /// - public bool IsComplete - { - get { return _result is not null; } - } - - XmlNode ITestRun.Result - { - get { return EngineResult.Xml; } - } - - bool ITestRun.Wait(int timeout) - { - return Wait(timeout); - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineException.cs b/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineException.cs deleted file mode 100644 index 78a550598..000000000 --- a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineException.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Runtime.Serialization; - -namespace NUnit.Engine -{ - /// - /// NUnitEngineException is thrown when the engine has been - /// called with improper values or when a particular facility - /// is not available. - /// - [Serializable] - public class NUnitEngineException : Exception - { - /// - /// Construct with a message - /// - public NUnitEngineException(string message) : base(message) - { - } - - /// - /// Construct with a message and inner exception - /// - public NUnitEngineException(string message, Exception? innerException) : base(message, innerException) - { - } - - /// - /// Serialization constructor - /// - public NUnitEngineException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineNotFoundException.cs b/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineNotFoundException.cs deleted file mode 100644 index 0584eeef3..000000000 --- a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineNotFoundException.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// The exception that is thrown if a valid test engine is not found - /// - [Serializable] - public class NUnitEngineNotFoundException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public NUnitEngineNotFoundException() : base() - { - } - } -} \ No newline at end of file diff --git a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineUnloadException.cs b/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineUnloadException.cs deleted file mode 100644 index 5da91348b..000000000 --- a/src/NUnitEngine/nunit.engine.api/Exceptions/NUnitEngineUnloadException.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace NUnit.Engine -{ - /// - /// NUnitEngineUnloadException is thrown when a test run has completed successfully - /// but one or more errors were encountered when attempting to unload - /// and shut down the test run cleanly. - /// - [Serializable] - public class NUnitEngineUnloadException : NUnitEngineException // Inherits from NUnitEngineException for backwards compatibility of calling runners - { - private const string AggregatedExceptionsMsg = - "Multiple exceptions encountered. Retrieve AggregatedExceptions property for more information"; - - /// - /// Construct with a message - /// - public NUnitEngineUnloadException(string message) : base(message) - { - } - - /// - /// Construct with a message and inner exception - /// - public NUnitEngineUnloadException(string message, Exception innerException) : base(message, innerException) - { - } - - /// - /// Construct with a message and a collection of exceptions. - /// - public NUnitEngineUnloadException(ICollection aggregatedExceptions) : base(AggregatedExceptionsMsg) - { - AggregatedExceptions = aggregatedExceptions; - } - - /// - /// Serialization constructor. - /// - public NUnitEngineUnloadException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - - /// - /// Gets the collection of exceptions . - /// - public ICollection? AggregatedExceptions { get; } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IAgentLauncher.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IAgentLauncher.cs deleted file mode 100644 index d24177969..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IAgentLauncher.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Diagnostics; - -namespace NUnit.Engine.Extensibility -{ - /// - /// Interface implemented by an agent launcher, which is able to examine - /// a test package, evaluate whether it can create an agent for it and - /// create the agent itself on request. - /// - public interface IAgentLauncher - { - /// - /// Gets a TestAgentInfo describing this agent - /// - TestAgentInfo AgentInfo { get; } - - /// - /// Returns true if the launcher can create an agent for the supplied package, otherwise false. - /// - bool CanCreateAgent(TestPackage package); - - /// - /// Returns an agent capable of running the specified package. - /// - Process CreateAgent(Guid agentId, string agencyUrl, TestPackage package); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IDriverFactory.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IDriverFactory.cs deleted file mode 100644 index 007f9e2d1..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IDriverFactory.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Reflection; - -namespace NUnit.Engine.Extensibility -{ - /// - /// Interface implemented by a Type that knows how to create a driver for a test assembly. - /// - public interface IDriverFactory - { - /// - /// Gets a flag indicating whether a given AssemblyName - /// represents a test framework supported by this factory. - /// - /// An AssemblyName referring to the possible test framework. - bool IsSupportedTestFramework(AssemblyName reference); - -#if NETFRAMEWORK - /// - /// Gets a driver for a given test assembly and a framework - /// which the assembly is already known to reference. - /// - /// The domain in which the assembly will be loaded - /// The driver id. - /// An AssemblyName referring to the test framework. - IFrameworkDriver GetDriver(AppDomain domain, string id, AssemblyName reference); -#else - /// - /// Gets a driver for a given test assembly and a framework - /// which the assembly is already known to reference. - /// - /// The driver id. - /// An AssemblyName referring to the test framework. - IFrameworkDriver GetDriver(string id, AssemblyName reference); -#endif - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IFrameworkDriver.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IFrameworkDriver.cs deleted file mode 100644 index f08ba0290..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IFrameworkDriver.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Collections.Generic; - -namespace NUnit.Engine.Extensibility -{ - /// - /// The IFrameworkDriver interface is implemented by a class that - /// is able to use an external framework to explore or run tests - /// under the engine. - /// - public interface IFrameworkDriver - { - /// - /// Gets and sets the unique identifier for this driver, - /// used to ensure that test ids are unique across drivers. - /// - string ID { get; } - - /// - /// Loads the tests in an assembly. - /// - /// An Xml string representing the loaded test - string Load(string testAssemblyPath, IDictionary settings); - - /// - /// Count the test cases that would be executed. - /// - /// An XML string representing the TestFilter to use in counting the tests - /// The number of test cases counted - int CountTestCases(string filter); - - /// - /// Executes the tests in an assembly. - /// - /// An ITestEventHandler that receives progress notices - /// A XML string representing the filter that controls which tests are executed - /// An Xml string representing the result - string Run(ITestEventListener? listener, string filter); - - /// - /// Executes the tests in an assembly asynchronously. - /// - /// An ITestEventHandler that receives progress notices - /// A filter that controls which tests are executed - void RunAsync(ITestEventListener? listener, string filter); - - /// - /// Returns information about the tests in an assembly. - /// - /// An XML string representing the filter that controls which tests are included - /// An Xml string representing the tests - string Explore(string filter); - - /// - /// Cancel the ongoing test run. If no test is running, the call is ignored. - /// - /// If true, cancel any ongoing test threads, otherwise wait for them to complete. - void StopRun(bool force); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IProject.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IProject.cs deleted file mode 100644 index 786e5b5bc..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IProject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Collections.Generic; - -namespace NUnit.Engine.Extensibility -{ - /// - /// Interface for the various project types that the engine can load. - /// - public interface IProject - { - /// - /// Gets the path to the file storing this project, if any. - /// If the project has not been saved, this is null. - /// - string ProjectPath { get; } - - /// - /// Gets the active configuration, as defined - /// by the particular project. - /// - string ActiveConfigName { get; } - - /// - /// Gets a list of the configs for this project - /// - IList ConfigNames { get; } - - /// - /// Gets a test package for the primary or active - /// configuration within the project. The package - /// includes all the assemblies and any settings - /// specified in the project format. - /// - /// A TestPackage - TestPackage GetTestPackage(); - - /// - /// Gets a TestPackage for a specific configuration - /// within the project. The package includes all the - /// assemblies and any settings specified in the - /// project format. - /// - /// The name of the config to use - /// A TestPackage for the named configuration. - TestPackage GetTestPackage(string configName); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IProjectLoader.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IProjectLoader.cs deleted file mode 100644 index 4ac8c570f..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IProjectLoader.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine.Extensibility -{ - /// - /// The IProjectLoader interface is implemented by any class - /// that knows how to load projects in a specific format. - /// - public interface IProjectLoader - { - /// - /// Returns true if the file indicated is one that this - /// loader knows how to load. - /// - /// The path of the project file - /// True if the loader knows how to load this file, otherwise false - bool CanLoadFrom(string path); - - /// - /// Loads a project of a known format. - /// - /// The path of the project file - /// An IProject interface to the loaded project or null if the project cannot be loaded - IProject LoadFrom(string path); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/Extensibility/IResultWriter.cs b/src/NUnitEngine/nunit.engine.api/Extensibility/IResultWriter.cs deleted file mode 100644 index e069bbb8c..000000000 --- a/src/NUnitEngine/nunit.engine.api/Extensibility/IResultWriter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.IO; -using System.Xml; - -namespace NUnit.Engine.Extensibility -{ - /// - /// Common interface for objects that process and write out test results - /// - public interface IResultWriter - { - /// - /// Checks if the output path is writable. If the output is not - /// writable, this method should throw an exception. - /// - /// The path to be checked - void CheckWritability(string outputPath); - - /// - /// Writes result to the specified output path. - /// - /// XmlNode for the result - /// Path to which it should be written - void WriteResultFile(XmlNode resultNode, string outputPath); - - /// - /// Writes result to a TextWriter. - /// - /// XmlNode for the result - /// TextWriter to which it should be written - void WriteResultFile(XmlNode resultNode, TextWriter writer); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IAgentInfoProvider.cs b/src/NUnitEngine/nunit.engine.api/IAgentInfoProvider.cs deleted file mode 100644 index 8c5fcecc0..000000000 --- a/src/NUnitEngine/nunit.engine.api/IAgentInfoProvider.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Collections.Generic; - -namespace NUnit.Engine.Services -{ - /// - /// Objects implementing IAgentInfoProvider can return information about - /// available agents. The interface is used by runners in order to provide - /// to the user or to allow selecting agents. - /// - public interface ITestAgentInfo - { - /// - /// Gets a list containing for all available agents. - /// - IList AvailableAgents { get; } - - /// - /// Gets a list containing for any available agents, - /// which are able to handle the specified package. - /// - /// A TestPackage - /// - /// A list of suitable agents for running the package or an empty - /// list if no agent is available for the package. - /// - IList GetAgentsForPackage(TestPackage package); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IAvailableRuntimes.cs b/src/NUnitEngine/nunit.engine.api/IAvailableRuntimes.cs deleted file mode 100644 index 2d9f223d9..000000000 --- a/src/NUnitEngine/nunit.engine.api/IAvailableRuntimes.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Collections.Generic; - -namespace NUnit.Engine -{ - /// - /// Interface that returns a list of available runtime frameworks. - /// - public interface IAvailableRuntimes - { - /// - /// Gets a list of available runtime frameworks for X64. - /// - IList AvailableRuntimes { get; } - - /// - /// Gets a list of available runtime frameworks for X86. - /// - IList AvailableX86Runtimes { get; } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IExtensionService.cs b/src/NUnitEngine/nunit.engine.api/IExtensionService.cs deleted file mode 100644 index 41b793ee1..000000000 --- a/src/NUnitEngine/nunit.engine.api/IExtensionService.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Collections.Generic; -using NUnit.Extensibility; - -namespace NUnit.Engine -{ - /// - /// The IExtensionService interface allows a runner to manage extensions. - /// - public interface IExtensionService - { - /// - /// Gets an enumeration of all extension points in the engine. - /// - /// An enumeration of IExtensionPoints. - IEnumerable ExtensionPoints { get; } - - /// - /// Gets an enumeration of all installed Extensions. - /// - /// An enumeration of IExtensionNodes - IEnumerable Extensions { get; } - - /// - /// Find candidate extension assemblies starting from a given base directory, - /// and using the contained '.addins' files to direct the search. - /// - /// Path to the initial directory. - void FindExtensionAssemblies(string initialDirectory); - - /// - /// Get an IExtensionPoint based on its unique identifying path. - /// - /// A single IExtensionPoint with the specified path if it exists. Otherwise null. - IExtensionPoint? GetExtensionPoint(string path); - - /// - /// Get an enumeration of IExtensionNodes based on their identifying path. - /// - /// An enumeration of IExtensionNodes. - IEnumerable GetExtensionNodes(string path); - - /// - /// Enable or disable an extension - /// - void EnableExtension(string typeName, bool enabled); - - /// - /// If extensions have not yet been installed, examine all candidate assemblies - /// and load them. Subsequent calls are ignored. - /// - /// - /// We can only install extensions after all candidate assemblies are identified. - /// This method may be called by the user after all "Find" calls are complete. - /// If the user fails to call it and subsequently tries to examine extensions - /// using certain ExtensionManager methods, it is called automatically. - /// - void InstallExtensions(); - - /// - /// Get extension objects for all nodes of a given type - /// - /// An enumeration of T - IEnumerable GetExtensions(); - - /// - /// Get all extension nodes of a given Type. - /// - /// An enumeration of IExtensionNodes for Type T. - IEnumerable GetExtensionNodes(); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IResultService.cs b/src/NUnitEngine/nunit.engine.api/IResultService.cs deleted file mode 100644 index b3212811f..000000000 --- a/src/NUnitEngine/nunit.engine.api/IResultService.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using NUnit.Engine.Extensibility; - -namespace NUnit.Engine -{ - /// - /// IResultWriterService provides result writers for a specified - /// well-known format. - /// - public interface IResultService - { - /// - /// Gets an array of the available formats - /// - string[] Formats { get; } - - /// - /// Gets a ResultWriter for a given format and set of arguments. - /// - /// The name of the format to be used - /// A set of arguments to be used in constructing the writer or null if non arguments are needed - /// An IResultWriter - IResultWriter GetResultWriter(string format, params object?[]? args); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IRuntimeFramework.cs b/src/NUnitEngine/nunit.engine.api/IRuntimeFramework.cs deleted file mode 100644 index 999261e62..000000000 --- a/src/NUnitEngine/nunit.engine.api/IRuntimeFramework.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// Interface implemented by objects representing a runtime framework. - /// - public interface IRuntimeFramework - { - /// - /// Gets the inique Id for this runtime, such as "net-4.5" - /// - string Id { get; } - - /// - /// Gets the display name of the framework, such as ".NET 4.5" - /// - string DisplayName { get; } - - /// - /// Gets the framework version: usually contains two components, Major - /// and Minor, which match the corresponding CLR components, but not always. - /// - Version FrameworkVersion { get; } - - /// - /// Gets a string representing the particular profile installed, - /// or null if there is no profile. Currently. the only defined - /// values are Full and Client. - /// - string? Profile { get; } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IRuntimeFrameworkService.cs b/src/NUnitEngine/nunit.engine.api/IRuntimeFrameworkService.cs deleted file mode 100644 index 7da9626df..000000000 --- a/src/NUnitEngine/nunit.engine.api/IRuntimeFrameworkService.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// Implemented by a type that provides information about the - /// current and other available runtimes. - /// - public interface IRuntimeFrameworkService - { - /// - /// Gets a RuntimeFramework instance representing the runtime under - /// which the code is currently running. - /// - IRuntimeFramework? CurrentFramework { get; } - - /// - /// Returns true if the runtime framework represented by - /// the string passed as an argument is available. - /// - /// A string representing a framework, like 'net-4.0' - /// A flag indicating whether X86 support is needed. - /// True if the framework is available, false if unavailable or nonexistent - bool IsAvailable(string framework, bool runAsX86); - - /// - /// Selects a target runtime framework for a TestPackage based on - /// the settings in the package and the assemblies themselves. - /// The package RuntimeFramework setting may be updated as a result. - /// - /// A TestPackage - void SelectRuntimeFramework(TestPackage package); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IService.cs b/src/NUnitEngine/nunit.engine.api/IService.cs deleted file mode 100644 index 2d9a745a1..000000000 --- a/src/NUnitEngine/nunit.engine.api/IService.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Diagnostics.CodeAnalysis; - -namespace NUnit.Engine -{ - /// - /// Enumeration representing the status of a service - /// - public enum ServiceStatus - { - /// Service was never started or has been stopped - Stopped, - /// Started successfully - Started, - /// Service failed to start and is unavailable - Error - } - - /// - /// The IService interface is implemented by all Services. Although it - /// is extensible, it does not reside in the Extensibility namespace - /// because it is so widely used by the engine. - /// - public interface IService - { - /// - /// The ServiceContext - /// - [DisallowNull] - IServiceLocator? ServiceContext { get; set; } - - /// - /// Gets the ServiceStatus of this service - /// - ServiceStatus Status { get; } - - /// - /// Initialize the Service - /// - void StartService(); - - /// - /// Do any cleanup needed before terminating the service - /// - void StopService(); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/IServiceLocator.cs b/src/NUnitEngine/nunit.engine.api/IServiceLocator.cs deleted file mode 100644 index b6d95b221..000000000 --- a/src/NUnitEngine/nunit.engine.api/IServiceLocator.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Diagnostics.CodeAnalysis; - -namespace NUnit.Engine -{ - /// - /// IServiceLocator allows clients to locate any NUnit services - /// for which the interface is referenced. In normal use, this - /// limits it to those services using interfaces defined in the - /// nunit.engine.api assembly. - /// - public interface IServiceLocator - { - /// - /// Return an instance of the specified type of service - /// - /// If service is not available - T GetService() - where T : class; - - /// - /// Return true and set service to an instance of the specified - /// type of service if it is available, otherwise return false; - /// - bool TryGetService([NotNullWhen(true)] out T? service) - where T : class; - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestAgency.cs b/src/NUnitEngine/nunit.engine.api/ITestAgency.cs deleted file mode 100644 index 9e5bf8a3d..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestAgency.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// The ITestAgency interface is implemented by a TestAgency in - /// order to allow TestAgents to register with it. - /// - public interface ITestAgency - { - /// - /// Registers an agent with an agency - /// - void Register(ITestAgent agent); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestAgent.cs b/src/NUnitEngine/nunit.engine.api/ITestAgent.cs deleted file mode 100644 index 66c70b997..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestAgent.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// The ITestAgent interface is implemented by remote test agents. - /// - public interface ITestAgent - { - /// - /// Gets a Guid that uniquely identifies this agent. - /// - Guid Id { get; } - - /// - /// Starts the agent, performing any required initialization - /// - /// True if successful, otherwise false - bool Start(); - - /// - /// Stops the agent, releasing any resources - /// - void Stop(); - - /// - /// Creates a test runner - /// - ITestEngineRunner CreateRunner(TestPackage package); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestEngine.cs b/src/NUnitEngine/nunit.engine.api/ITestEngine.cs deleted file mode 100644 index c5ebc83b6..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestEngine.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// ITestEngine represents an instance of the test engine. - /// Clients wanting to discover, explore or run tests start - /// require an instance of the engine, which is generally - /// acquired from the TestEngineActivator class. - /// - public interface ITestEngine : IDisposable - { - /// - /// Gets the IServiceLocator interface, which gives access to - /// certain services provided by the engine. - /// - IServiceLocator Services { get; } - - /// - /// Gets and sets the directory path used by the engine for saving files. - /// Some services may ignore changes to this path made after initialization. - /// The default value is the current directory. - /// - string WorkDirectory { get; set; } - - /// - /// Gets and sets the InternalTraceLevel used by the engine. Changing this - /// setting after initialization will have no effect. The default value - /// is the value saved in the NUnit settings. - /// - InternalTraceLevel InternalTraceLevel { get; set; } - - /// - /// Initialize the engine. This includes initializing mono addins, - /// setting the trace level and creating the standard set of services - /// used in the Engine. - /// - /// This interface is not normally called by user code. Programs linking - /// only to the nunit.engine.api assembly are given a - /// pre-initialized instance of TestEngine. Programs - /// that link directly to nunit.engine usually do so - /// in order to perform custom initialization. - /// - void Initialize(); - - /// - /// Returns a test runner instance for use by clients in discovering, - /// exploring and executing tests. - /// - /// The TestPackage for which the runner is intended. - /// An ITestRunner. - ITestRunner GetRunner(TestPackage package); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestEngineRunner.cs b/src/NUnitEngine/nunit.engine.api/ITestEngineRunner.cs deleted file mode 100644 index fb59c0c4a..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestEngineRunner.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// Interface implemented by all internal test runners in - /// the engine, allowing them to pass back TestEngineResults - /// to any higher-level runner that calls them. - /// - public interface ITestEngineRunner : IDisposable - { - /// - /// Load a TestPackage for possible execution - /// - /// A TestEngineResult. - TestEngineResult Load(); - - /// - /// Unload any loaded TestPackage. If none is loaded, - /// the call is ignored. - /// - void Unload(); - - /// - /// Reload the loaded test package. - /// - /// A TestEngineResult. - /// If no package is loaded. - TestEngineResult Reload(); - - /// - /// Count the test cases that would be run under - /// the specified filter. - /// - /// A TestFilter - /// The count of test cases - int CountTestCases(TestFilter filter); - - /// - /// Run the tests in the loaded TestPackage and return a test result. The tests - /// are run synchronously and the listener interface is notified as it progresses. - /// - /// An ITestEventHandler to receive events - /// A TestFilter used to select tests - /// A TestEngineResult giving the result of the test execution - TestEngineResult Run(ITestEventListener listener, TestFilter filter); - - /// - /// Start a run of the tests in the loaded TestPackage. The tests are run - /// asynchronously and the listener interface is notified as it progresses. - /// - /// An ITestEventHandler to receive events - /// A TestFilter used to select tests - /// An that will provide the result of the test execution - AsyncTestEngineResult RunAsync(ITestEventListener listener, TestFilter filter); - - /// - /// Request the current test run to stop. If no tests are running, - /// the call is ignored. - /// - void RequestStop(); - - /// - /// Force the current test run to stop, killing threads or processes if necessary. - /// If no tests are running, the call is ignored. - /// - void ForcedStop(); - - /// - /// Explore a loaded TestPackage and return information about - /// the tests found. - /// - /// Criteria used to filter the search results - /// A TestEngineResult. - TestEngineResult Explore(TestFilter filter); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestEventListener.cs b/src/NUnitEngine/nunit.engine.api/ITestEventListener.cs deleted file mode 100644 index e6646aeab..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestEventListener.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// The ITestListener interface is used to receive notices of significant - /// events while a test is running. Its single method accepts an Xml string, - /// which may represent any event generated by the test framework, the driver - /// or any of the runners internal to the engine. Use of Xml means that - /// any driver and framework may add additional events and the engine will - /// simply pass them on through this interface. - /// - public interface ITestEventListener - { - /// - /// Handle a progress report or other event. - /// - /// An XML progress report. - void OnTestEvent(string report); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestFilterBuilder.cs b/src/NUnitEngine/nunit.engine.api/ITestFilterBuilder.cs deleted file mode 100644 index 040d2a7cb..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestFilterBuilder.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// Interface to a TestFilterBuilder, which is used to create TestFilters - /// - public interface ITestFilterBuilder - { - /// - /// Add a test to be selected - /// - /// The full name of the test, as created by NUnit - void AddTest(string fullName); - - /// - /// Specify what is to be included by the filter using a where clause. - /// - /// A where clause that will be parsed by NUnit to create the filter. - void SelectWhere(string whereClause); - - /// - /// Get a TestFilter constructed according to the criteria specified by the other calls. - /// - /// A TestFilter. - TestFilter GetFilter(); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestFilterService.cs b/src/NUnitEngine/nunit.engine.api/ITestFilterService.cs deleted file mode 100644 index 07a9de15b..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestFilterService.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// The TestFilterService provides builders that can create TestFilters - /// - public interface ITestFilterService - { - /// - /// Get an uninitialized TestFilterBuilder - /// - ITestFilterBuilder GetTestFilterBuilder(); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestRun.cs b/src/NUnitEngine/nunit.engine.api/ITestRun.cs deleted file mode 100644 index d06394676..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestRun.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Xml; - -namespace NUnit.Engine -{ - /// - /// The ITestRun class represents an ongoing test run. - /// - public interface ITestRun - { - /// - /// Get the result of the test. - /// - /// An XmlNode representing the test run result - XmlNode Result { get; } - - /// - /// Blocks the current thread until the current test run completes - /// or the timeout is reached - /// - /// A that represents the number of milliseconds to wait or -1 milliseconds to wait indefinitely. - /// True if the run completed - bool Wait(int timeout); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/ITestRunner.cs b/src/NUnitEngine/nunit.engine.api/ITestRunner.cs deleted file mode 100644 index 2d14121db..000000000 --- a/src/NUnitEngine/nunit.engine.api/ITestRunner.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Xml; - -namespace NUnit.Engine -{ - /// - /// Interface implemented by all test runners. - /// - public interface ITestRunner : IDisposable - { - /// - /// Get a flag indicating whether a test is running - /// - bool IsTestRunning { get; } - - /// - /// Load a TestPackage for possible execution - /// - /// An XmlNode representing the loaded package. - /// - /// This method is normally optional, since Explore and Run call - /// it automatically when necessary. The method is kept in order - /// to make it easier to convert older programs that use it. - /// - XmlNode Load(); - - /// - /// Unload any loaded TestPackage. If none is loaded, - /// the call is ignored. - /// - void Unload(); - - /// - /// Reload the current TestPackage - /// - /// An XmlNode representing the loaded package. - XmlNode Reload(); - - /// - /// Count the test cases that would be run under - /// the specified filter. - /// - /// A TestFilter - /// The count of test cases - int CountTestCases(TestFilter filter); - - /// - /// Run the tests in the loaded TestPackage and return a test result. The tests - /// are run synchronously and the listener interface is notified as it progresses. - /// - /// The listener that receives progress reports or null, to avoid transmitting those reports. - /// A TestFilter used to select tests - /// An XmlNode giving the result of the test execution - XmlNode Run(ITestEventListener? listener, TestFilter filter); - - /// - /// Start a run of the tests in the loaded TestPackage. The tests are run - /// asynchronously and the listener interface is notified as it progresses. - /// - /// The listener that receives progress reports or null, to avoid transmitting those reports. - /// A TestFilter used to select tests - ITestRun RunAsync(ITestEventListener? listener, TestFilter filter); - - /// - /// Cancel the ongoing test run. If no test is running, the call is ignored. - /// - /// If true, cancel any ongoing test threads, otherwise wait for them to complete. - void StopRun(bool force); - - /// - /// Explore a loaded TestPackage and return information about the tests found. - /// - /// The TestFilter to be used in selecting tests to explore. - /// An XmlNode representing the tests found. - XmlNode Explore(TestFilter filter); - } -} diff --git a/src/NUnitEngine/nunit.engine.api/InternalTraceLevel.cs b/src/NUnitEngine/nunit.engine.api/InternalTraceLevel.cs deleted file mode 100644 index 9d86a60a0..000000000 --- a/src/NUnitEngine/nunit.engine.api/InternalTraceLevel.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// InternalTraceLevel is an enumeration controlling the - /// level of detailed presented in the internal log. - /// - public enum InternalTraceLevel - { - /// - /// Use the default settings as specified by the user. - /// - Default, - - /// - /// Do not display any trace messages - /// - Off, - - /// - /// Display Error messages only - /// - Error, - - /// - /// Display Warning level and higher messages - /// - Warning, - - /// - /// Display informational and higher messages - /// - Info, - - /// - /// Display debug messages and higher - i.e. all messages - /// - Debug, - - /// - /// Display debug messages and higher - i.e. all messages - /// - Verbose = Debug - } -} diff --git a/src/NUnitEngine/nunit.engine.api/PackageSetting.cs b/src/NUnitEngine/nunit.engine.api/PackageSetting.cs deleted file mode 100644 index 1821d65fa..000000000 --- a/src/NUnitEngine/nunit.engine.api/PackageSetting.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Xml; - -namespace NUnit.Engine -{ - /// - /// Abstract base for all generic package Settings - /// - public abstract class PackageSetting - { - /// - /// Construct a PackageSetting - /// - /// The name of this setting. - /// The value of the setting - protected PackageSetting(string name, object value) - { - Name = name; - Value = value; - } - - /// - /// Gets the name of this setting. - /// - public string Name { get; } - - /// - /// Gets the value of this setting as an object. - /// - public object Value { get; } - } - - /// - /// The PackageSetting class represents one setting value contained in a - /// TestPackage. Instances of PackageSetting are immutable. - /// - public sealed class PackageSetting : PackageSetting - where T : notnull - { - /// - /// Construct a PackageSetting - /// - /// The setting name. - /// The value of this setting instance. - public PackageSetting(string name, T value) : base(name, value) - { - Value = value; - } - - /// - /// Get the setting value - /// - public new T Value { get; } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/PackageSettings.cs b/src/NUnitEngine/nunit.engine.api/PackageSettings.cs deleted file mode 100644 index 0d7e50935..000000000 --- a/src/NUnitEngine/nunit.engine.api/PackageSettings.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using NUnit.Common; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Xml.Linq; - -namespace NUnit.Engine -{ - /// - /// PackageSettings contains all the settings applied to a TestPackage. - /// It supports enumeration of the settings and various operations on - /// individual settings in the list. - /// - public class PackageSettings : IEnumerable - { - private readonly Dictionary _settings = new(); - - /// - /// Gets the number of settings in the list - /// - public int Count => _settings.Count; - - /// - /// Returns true if a setting with the specified name is present - /// - public bool HasSetting(string name) => _settings.ContainsKey(name); - - /// - /// Returns true if a setting with the specified definition is present - /// - public bool HasSetting(SettingDefinition setting) => _settings.ContainsKey(setting.Name); - - /// - /// Return the value of a setting if present, otherwise null. - /// - /// The name of the setting - public object GetSetting(string name) - { - return _settings[name].Value; - } - - /// - /// Return the value of a setting or its defined default value. - /// - /// The name and type of the setting - public T GetValueOrDefault(SettingDefinition definition) - where T : notnull - { - if (_settings.TryGetValue(definition.Name, out PackageSetting? unTypedSetting)) - if (unTypedSetting is PackageSetting typedSetting && typedSetting is not null) - return typedSetting.Value; - - return definition.DefaultValue; - } - - /// - public IEnumerator GetEnumerator() => _settings.Values.GetEnumerator(); - - /// - IEnumerator IEnumerable.GetEnumerator() => _settings.Values.GetEnumerator(); - - /// - /// Adds a setting to the list directly. - /// - /// A PackageSetting instance - public void Add(PackageSetting setting) => _settings.Add(setting.Name, setting); - - /// - /// Creates and adds a setting to the list, specified by the name and a string value. - /// The string value is converted to a typed PackageSetting if the name specifies a known SettingDefinition. - /// - /// The name of the setting. - /// The corresponding value to set. - public void Add(string name, string value) - { - var definition = SettingDefinitions.Lookup(name); - - // If this is a known setting but not a string throw an exception - if (definition is not null && !definition.ValueType.IsAssignableFrom(typeof(string))) - throw (new ArgumentException($"The {name} setting requires a value of type {definition.ValueType.Name}")); - - // Otherwise add it - Add(new PackageSetting(name, value)); - } - - /// - /// Creates and adds a custom boolean setting to the list, specifying the name and value. - /// - /// The name of the setting. - /// The corresponding value to set. - public void Add(string name, bool value) - { - var definition = SettingDefinitions.Lookup(name); - - // If this is a known setting but not a boolean throw an exception - if (definition is not null && !definition.ValueType.IsAssignableFrom(typeof(bool))) - throw (new ArgumentException($"The {name} setting requires a value of type {definition.ValueType.Name}")); - - Add(new PackageSetting(name, value)); - } - - /// - /// Creates and adds a custom int setting to the list, specifying the name and value. - /// - /// The name of the setting. - /// The corresponding value to set. - public void Add(string name, int value) - { - var definition = SettingDefinitions.Lookup(name); - - // If this is a known setting but not an int throw an exception - if (definition is not null && !definition.ValueType.IsAssignableFrom(typeof(int))) - throw (new ArgumentException($"The {name} setting requires a value of type {definition.ValueType.Name}")); - - Add(new PackageSetting(name, value)); - } - - /// - /// Adds or replaces a setting to the list. - /// - public void Set(PackageSetting setting) => _settings[setting.Name] = setting; - - /// - /// Adds or replaces a setting to the list. - /// - /// The name of the setting. - /// The corresponding value to set. - public void Set(string name, T value) - where T : notnull - { - Set(new PackageSetting(name, value)); - } - - /// - /// Remove a setting - /// - /// The setting to remove - public void Remove(SettingDefinition setting) - { - _settings.Remove(setting.Name); - } - - /// - /// Remove a setting - /// - /// The name of the setting to remove - public void Remove(string settingName) - { - _settings.Remove(settingName); - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/SettingDefinition.cs b/src/NUnitEngine/nunit.engine.api/SettingDefinition.cs deleted file mode 100644 index e8419ac1d..000000000 --- a/src/NUnitEngine/nunit.engine.api/SettingDefinition.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// - /// - public abstract class SettingDefinition - { - /// - /// Initializes a new instance of the class. - /// - public SettingDefinition(string name, Type valueType) - { - Name = name; - ValueType = valueType; - } - - /// - /// Gets the name of this setting. - /// - public string Name { get; } - - /// - /// Overridden in each derived definition to return the Type - /// required for the value of the setting. - /// - public Type ValueType { get; } - - /// - /// Create a PackageSetting based on this definition. - /// - /// The value to assign the setting. - /// A PackageSetting. - public PackageSetting WithValue(T value) - where T : notnull - { - if (ValueType.IsAssignableFrom(typeof(T))) - return new PackageSetting(Name, (T)Convert.ChangeType(value, ValueType)); - - throw (new ArgumentException($"The {Name} setting requires a value of type {ValueType.Name}")); - } - } - - /// - /// SettingDefinition class is used as a sort of template for creating settings. - /// It specifies the name of the setting and the Type required for its value but not - /// the value itself. Its WithValue method is used to generate an actual PackageSetting. - /// - public sealed class SettingDefinition : SettingDefinition - where T : notnull - { - /// - /// Construct a SettingDefinition - /// - /// Name of this setting - /// The default value used when the setting is not provided - public SettingDefinition(string name, T defaultValue) - : base(name, typeof(T)) - { - DefaultValue = defaultValue; - } - - /// - /// The Default value used if the setting is not present - /// - public T DefaultValue { get; } - - /// - /// Create a PackageSetting based on this definition. - /// - /// The value to assign the setting. - /// A PackageSetting. - public PackageSetting WithValue(T value) - { - return new PackageSetting(Name, value); - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/SettingDefinitions.cs b/src/NUnitEngine/nunit.engine.api/SettingDefinitions.cs deleted file mode 100644 index 01877d071..000000000 --- a/src/NUnitEngine/nunit.engine.api/SettingDefinitions.cs +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using NUnit.Engine; -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; - -namespace NUnit.Common -{ - /// - /// Static class holding SettingDefinitions for all standard package settings - /// known to the runner and engine. Except for internal settings with names - /// starting "Image...", the runner creates the settings. Some settings are - /// used by the engine, some by the framework and some by both. - /// - public static class SettingDefinitions - { - private static readonly Dictionary _knownSettings; - - static SettingDefinitions() - { - // Use Reflection to build a dictionary of all known setting definitions - var properties = typeof(SettingDefinitions).GetProperties(BindingFlags.Public | BindingFlags.Static); - - _knownSettings = new Dictionary(); - - foreach (var property in properties) - { - var propValue = property.GetValue(null, null) as SettingDefinition; - if (propValue is not null) - _knownSettings.Add(property.Name, propValue); - } - } - - /// - /// Lookup a known SettingDefinition by name - /// - /// The name of the setting - /// A SettingDefinition if there is one, otherwise null. - public static SettingDefinition? Lookup(string name) - { - if (_knownSettings.TryGetValue(name, out var definition)) - return definition; - return null; - } - - #region Settings Used by the Engine - - /// - /// The name of the config to use in loading a project. - /// If not specified, the first config found is used. - /// - public static SettingDefinition ActiveConfig { get; } = new(nameof(ActiveConfig), string.Empty); - - /// - /// Bool indicating whether the engine should determine the private - /// bin path by examining the paths to all the tests. Defaults to - /// true unless PrivateBinPath is specified. - /// - public static SettingDefinition AutoBinPath { get; } = new(nameof(AutoBinPath), false); - - /// - /// The ApplicationBase to use in loading the tests. If not - /// specified, and each assembly has its own process, then the - /// location of the assembly is used. For multiple assemblies - /// in a single process, the closest common root directory is used. - /// - public static SettingDefinition BasePath { get; } = new(nameof(BasePath), string.Empty); - - /// - /// Path to the config file to use in running the tests. - /// - public static SettingDefinition ConfigurationFile { get; } = new(nameof(ConfigurationFile), string.Empty); - - /// - /// A list of the available configs for this project. - /// - public static SettingDefinition ConfigNames { get; } = new(nameof(ConfigNames), string.Empty); - - ///// - ///// Flag (bool) indicating whether tests are being debugged. - ///// - //public static SettingDefinition DebugTests { get; } = new(nameof(DebugTests)); - - /// - /// Bool flag indicating whether a debugger should be launched at agent - /// startup. Used only for debugging NUnit itself. - /// - public static SettingDefinition DebugAgent { get; } = new(nameof(DebugAgent), false); - - /// - /// Bool flag indicating whether a debugger should be launched at console - /// startup. Used only for debugging NUnit itself. - /// - public static SettingDefinition DebugConsole { get; } = new(nameof(DebugConsole), false); - - /// - /// The private binpath used to locate assemblies. Directory paths - /// is separated by a semicolon. It's an error to specify this and - /// also set AutoBinPath to true. - /// - public static SettingDefinition PrivateBinPath { get; } = new(nameof(PrivateBinPath), string.Empty); - - /// - /// The maximum number of test agents permitted to run simultaneously. - /// - public static SettingDefinition MaxAgents { get; } = new(nameof(MaxAgents), 0); - - /// - /// Indicates the desired runtime to use for the tests. Values - /// are strings like "net-4.5", "mono-4.0", etc. Default is to - /// use the target framework for which an assembly was built. - /// - public static SettingDefinition RequestedRuntimeFramework { get; } = new(nameof(RequestedRuntimeFramework), string.Empty); - - /// - /// Indicates the desired runtime to use for the tests. Values - /// are strings like "net-4.5", "mono-4.0", etc. Default is to - /// use the target framework for which an assembly was built. - /// - public static SettingDefinition RequestedFrameworkName { get; } = new(nameof(RequestedFrameworkName), string.Empty); - - /// - /// Indicates the Target runtime selected for use by the engine, - /// based on the requested runtime and assembly metadata. - /// - public static SettingDefinition TargetFrameworkName { get; } = new(nameof(TargetFrameworkName), string.Empty); - - /// - /// Indicates the name of the agent requested by the user. - /// - public static SettingDefinition RequestedAgentName { get; } = new(nameof(RequestedAgentName), string.Empty); - - /// - /// Indicates the name of the agent that was actually used. - /// - public static SettingDefinition SelectedAgentName { get; } = new(nameof(SelectedAgentName), string.Empty); - - /// - /// Bool flag indicating that the test should be run in a 32-bit process - /// on a 64-bit system. By default, NUNit runs in a 64-bit process on - /// a 64-bit system. Ignored if set on a 32-bit system. - /// - public static SettingDefinition RunAsX86 { get; } = new(nameof(RunAsX86), false); - - /// - /// Indicates that test runners should be disposed after the tests are executed - /// - public static SettingDefinition DisposeRunners { get; } = new(nameof(DisposeRunners), false); - - /// - /// Bool flag indicating that the test assemblies should be shadow copied. - /// Defaults to false. - /// - public static SettingDefinition ShadowCopyFiles { get; } = new(nameof(ShadowCopyFiles), false); - - /// - /// Bool flag indicating that user profile should be loaded on test runner processes - /// - public static SettingDefinition LoadUserProfile { get; } = new(nameof(LoadUserProfile), false); - - /// - /// Bool flag indicating that non-test assemblies should be skipped without error. - /// - public static SettingDefinition SkipNonTestAssemblies { get; } = new(nameof(SkipNonTestAssemblies), false); - - /// - /// Int value in milliseconds used to cancel the entire test run if it is exceeded. - /// - public static SettingDefinition TestRunTimeout { get; } = new SettingDefinition(nameof(TestRunTimeout), 0); - - ///// - ///// Flag (bool) indicating whether to pause execution of tests to allow - ///// the user to attach a debugger. - ///// - //public static SettingDefinition PauseBeforeRun { get; } = new(nameof(PauseBeforeRun)); - - ///// - ///// The InternalTraceLevel for this run. Values are: "Default", - ///// "Off", "Error", "Warning", "Info", "Debug", "Verbose". - ///// Default is "Off". "Debug" and "Verbose" are synonyms. - ///// - //public static SettingDefinition InternalTraceLevel { get; } = new(nameof(InternalTraceLevel)); - - /// - /// The PrincipalPolicy to set on the test application domain. Values are: - /// "UnauthenticatedPrincipal", "NoPrincipal" and "WindowsPrincipal". - /// - public static SettingDefinition PrincipalPolicy { get; } = new(nameof(PrincipalPolicy), string.Empty); - - ///// - ///// Full path of the directory to be used for work and result files. - ///// This path is provided to tests by the framework TestContext. - ///// - //public static SettingDefinition WorkDirectory { get; } = new(nameof(WorkDirectory)); - - /// - /// Set to true to list statistics for dependency resolution under .NET Core. - /// - public static SettingDefinition ListResolutionStats { get; } = new(nameof(ListResolutionStats), false); - -#endregion - - #region Settings Used by both the Engine and the Framework - - /// - /// Flag (bool) indicating whether tests are being debugged. - /// - public static SettingDefinition DebugTests { get; } = new(nameof(DebugTests), false); - - /// - /// Flag (bool) indicating whether to pause execution of tests to allow - /// the user to attach a debugger. - /// - public static SettingDefinition PauseBeforeRun { get; } = new(nameof(PauseBeforeRun), false); - - /// - /// The InternalTraceLevel for this run. Values are: "Default", - /// "Off", "Error", "Warning", "Info", "Debug", "Verbose". - /// Default is "Off". "Debug" and "Verbose" are synonyms. - /// - public static SettingDefinition InternalTraceLevel { get; } = new(nameof(InternalTraceLevel), "Off"); - - /// - /// Full path of the directory to be used for work and result files. - /// This path is provided to tests by the framework TestContext. - /// - public static SettingDefinition WorkDirectory { get; } = new(nameof(WorkDirectory), string.Empty); - - #endregion - - #region Internal Settings Used Only within the Engine - - /// - /// If the package represents an assembly, then this is the CLR version - /// stored in the assembly image. If it represents a project or other - /// group of assemblies, it is the maximum version for all the assemblies. - /// - public static SettingDefinition ImageRuntimeVersion { get; } = new(nameof(ImageRuntimeVersion), "2.0"); - - /// - /// True if any assembly in the package requires running as a 32-bit - /// process when on a 64-bit system. - /// - public static SettingDefinition ImageRequiresX86 { get; } = new(nameof(ImageRequiresX86), false); - - /// - /// True if any assembly in the package requires a special assembly resolution hook - /// in the default application domain in order to find dependent assemblies. - /// - public static SettingDefinition ImageRequiresDefaultAppDomainAssemblyResolver { get; } = new(nameof(ImageRequiresDefaultAppDomainAssemblyResolver), false); - - /// - /// The FrameworkName specified on a TargetFrameworkAttribute for the assembly - /// - public static SettingDefinition ImageTargetFrameworkName { get; } = new(nameof(ImageTargetFrameworkName), string.Empty); - - /// - /// Set this to true to force use of the default assembly load context for the - /// test assembly and in resolving all dependencies rather than creating and - /// using a separate instance of AssemblyLoadContext. - /// - /// - /// This is provided for use by the NUnit3 VS Adapter and may not work if used - /// outside of that context. It must be set in the top-level package via the - /// AddSetting method so that the same value is passed to all subpackages. - /// - public const string UseDefaultAssemblyLoadContext = "UseDefaultAssemblyLoadContext"; - - #endregion - - #region Settings Used by the NUnit Framework - - /// - /// Integer value in milliseconds for the default timeout value - /// for test cases. If not specified, there is no timeout except - /// as specified by attributes on the tests themselves. - /// - public static SettingDefinition DefaultTimeout { get; } = new(nameof(DefaultTimeout), 0); - - /// - /// A string representing the default thread culture to be used for - /// running tests. String should be a valid BCP-47 culture name. If - /// culture is unset, tests run on the machine's default culture. - /// - public static SettingDefinition DefaultCulture { get; } = new(nameof(DefaultCulture), string.Empty); - - /// - /// A string representing the default thread UI culture to be used for - /// running tests. String should be a valid BCP-47 culture name. If - /// culture is unset, tests run on the machine's default culture. - /// - public static SettingDefinition DefaultUICulture { get; } = new(nameof(DefaultUICulture), string.Empty); - - /// - /// A TextWriter to which the internal trace will be sent. - /// - public static SettingDefinition InternalTraceWriter { get; } = new(nameof(InternalTraceWriter), null!); - - /// - /// A list of tests to be loaded. - /// - public static SettingDefinition> LOAD { get; } = new(nameof(LOAD), Array.Empty()); - - /// - /// The number of test threads to run for the assembly. If set to - /// 1, a single queue is used. If set to 0, tests are executed - /// directly, without queuing. - /// - public static SettingDefinition NumberOfTestWorkers { get; } = new(nameof(NumberOfTestWorkers), 1); - - /// - /// The random seed to be used for this assembly. If specified - /// as the value reported from a prior run, the framework should - /// generate identical random values for tests as were used for - /// that run, provided that no change has been made to the test - /// assembly. Default is a random value itself. - /// - public static SettingDefinition RandomSeed { get; } = new(nameof(RandomSeed), 0); - - /// - /// If true, execution stops after the first error or failure. - /// - public static SettingDefinition StopOnError { get; } = new(nameof(StopOnError), false); - - /// - /// If true, asserts in multiple asserts block will throw first-chance exception on failure. - /// - public static SettingDefinition ThrowOnEachFailureUnderDebugger { get; } = new(nameof(ThrowOnEachFailureUnderDebugger), false); - - /// - /// If true, use of the event queue is suppressed and test events are synchronous. - /// - public static SettingDefinition SynchronousEvents { get; } = new(nameof(SynchronousEvents), false); - - /// - /// The default naming pattern used in generating test names - /// - public static SettingDefinition DefaultTestNamePattern { get; } = new(nameof(DefaultTestNamePattern), string.Empty); - - /// - /// Parameters to be passed on to the tests, serialized to a single string which needs parsing. - /// Obsoleted by ; kept for backward compatibility. - /// - public static SettingDefinition TestParameters { get; } = new(nameof(TestParameters), string.Empty); - - /// - /// If true, the tests will run on the same thread as the NUnit runner itself - /// - public static SettingDefinition RunOnMainThread { get; } = new(nameof(RunOnMainThread), false); - - /// - /// Parameters to be passed on to the tests, already parsed into an IDictionary<string, string>. Replaces . - /// - public static SettingDefinition> TestParametersDictionary { get; } = new(nameof(TestParametersDictionary), new Dictionary()); - - #endregion - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestAgentInfo.cs b/src/NUnitEngine/nunit.engine.api/TestAgentInfo.cs deleted file mode 100644 index d57ebb55a..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestAgentInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System.Runtime.Versioning; - -namespace NUnit.Engine -{ - /// - /// The TestAgentInfo struct provides information about an - /// available agent for use by a runner. - /// - public readonly struct TestAgentInfo - { - /// - /// The name of this agent - /// - public readonly string AgentName; - - /// - /// The agent type: InProcess, LocalProcess or RemoteProcess - /// - public readonly TestAgentType AgentType; - - /// - /// The target runtime used by this agent - /// - public readonly FrameworkName TargetRuntime; - - /// - /// Construct a TestAgent Info - /// - /// The agent name - /// The AgentType - /// The target runtime - public TestAgentInfo(string agentName, TestAgentType agentType, FrameworkName targetRuntime) - { - AgentName = agentName; - AgentType = agentType; - TargetRuntime = targetRuntime; - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestAgentType.cs b/src/NUnitEngine/nunit.engine.api/TestAgentType.cs deleted file mode 100644 index 58966019a..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestAgentType.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -namespace NUnit.Engine -{ - /// - /// TestAgentType is an enumeration of the types - /// of agents, which may be available. Currently, three - /// types are defined, of which one is implemented. - /// - /// - /// A user requests a particular agent type by including a - /// "TestAgentType" setting in the test package. The setting - /// is optional and the runner will select an agent of any - /// type available if it isn't specified. - /// - public enum TestAgentType - { - /// - /// Any agent type is acceptable. This is the default value, - /// so it never needs to be specified by the user. This - /// setting is not valid in the TestAgentInfo struct, since - /// each agent must be of some particular type. - /// - Any = 0, - - /// - /// An in-process agent. This type is not directly supported - /// by the engine but may be provided by an extension. - /// - InProcess = 1, - - /// - /// An agent running as a separate local process. - /// A supplier for this type is built into the engine. - /// - LocalProcess = 2, - - /// - /// An agent running on a server, that is a separate - /// machine, which may be specified in the request or - /// left up to the agent supplier to determine. A supplier - /// for this type may be developed in the future. - /// - RemoteProcess = 3 - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestEngineResult.cs b/src/NUnitEngine/nunit.engine.api/TestEngineResult.cs deleted file mode 100644 index f63608bef..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestEngineResult.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Collections.Generic; -using System.Xml; - -namespace NUnit.Engine -{ - /// - /// Wrapper class for the xml-formatted results produced - /// by the test engine for most operations. The XML is - /// stored as a string in order to allow serialization - /// and actual XmlNodes are created on demand. - /// - /// In principal, there should only be one XmlNode in - /// a result. However, as work progresses, there may - /// temporarily be multiple nodes, which have not yet - /// been aggregated under a higher level suite. For - /// that reason, TestEngineResult maintains a list - /// of XmlNodes and another of the corresponding text. - /// - /// Static methods are provided for aggregating the - /// internal XmlNodes into a single node as well as - /// for combining multiple TestEngineResults into one. - /// - /// - [Serializable] - public class TestEngineResult - { - private readonly List _xmlText = new List(); - - [NonSerialized] - private List _xmlNodes = new List(); - - /// - /// Construct a TestResult from an XmlNode - /// - /// An XmlNode representing the result - public TestEngineResult(XmlNode xml) - { - this._xmlNodes.Add(xml); - this._xmlText.Add(xml.OuterXml); - } - - /// - /// Construct a test from a string holding xml - /// - /// A string containing the xml result - public TestEngineResult(string xml) - { - this._xmlText.Add(xml); - } - - /// - /// Default constructor used when adding multiple results - /// - public TestEngineResult() - { - } - - /// - /// Gets a flag indicating whether this is a single result - /// having only one XmlNode associated with it. - /// - public bool IsSingle - { - get { return _xmlText.Count == 1; } - } - - /// - /// Gets the xml representing a test result as an XmlNode - /// - public IList XmlNodes - { - get - { - // xmlNodes might be null after deserialization - if (_xmlNodes is null) - _xmlNodes = new List(); - - for (int i = _xmlNodes.Count; i < _xmlText.Count; i++) - { - XmlDocument doc = new XmlDocument(); - doc.LoadXml(_xmlText[i]); - // TODO: Should we throw if first child is null? - if (doc.FirstChild is not null) - _xmlNodes.Add(doc.FirstChild); - } - - return _xmlNodes; - } - } - - /// - /// Gets the XML representing a single test result. - /// - /// - /// If the result is empty or has multiple XML nodes. - /// - public XmlNode Xml - { - get - { - // TODO: Fix this in some way and also allow for a count of zero - if (!IsSingle) - throw new InvalidOperationException("May not use 'Xml' property on a result with multiple XmlNodes"); - - return XmlNodes[0]; - } - } - - // TODO: Make sure this is not needed then delete - //public void Add(string xml) - //{ - // this._xmlText.Add(xml); - //} - - /// - /// Add an XmlNode to the TestEngineResult - /// - public void Add(XmlNode xml) - { - this._xmlText.Add(xml.OuterXml); - this._xmlNodes.Add(xml); - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestFilter.cs b/src/NUnitEngine/nunit.engine.api/TestFilter.cs deleted file mode 100644 index b9d234182..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestFilter.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; - -namespace NUnit.Engine -{ - /// - /// Abstract base for all test filters. A filter is represented - /// by an XmlNode with <filter> as its topmost element. - /// In the console runner, filters serve only to carry this - /// XML representation, as all filtering is done by the engine. - /// - [Serializable] - public class TestFilter - { - /// - /// Initializes a new instance of the class. - /// - /// The XML text that specifies the filter. - public TestFilter(string xmlText) - { - Text = xmlText; - } - - /// - /// The empty filter - one that always passes. - /// - public static readonly TestFilter Empty = new TestFilter(""); - - /// - /// Gets the XML representation of this filter as a string. - /// - public string Text { get; } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestPackage.cs b/src/NUnitEngine/nunit.engine.api/TestPackage.cs deleted file mode 100644 index 085cb9939..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestPackage.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Collections.Generic; -using System.IO; - -namespace NUnit.Engine -{ - /// - /// TestPackage holds information about a set of test files to - /// be loaded by a TestRunner. Each TestPackage represents - /// tests for one or more test files. TestPackages may be named - /// or anonymous, depending on the constructor used. - /// - /// Upon construction, a package is given an ID (string), which - /// remains unchanged for the lifetime of the TestPackage instance. - /// The package ID is passed to the test framework for use in generating - /// test IDs. - /// - /// A runner that reloads test assemblies and wants the ids to remain stable - /// should avoid creating a new package but should instead use the original - /// package, changing settings as needed. This gives the best chance for the - /// tests in the reloaded assembly to match those originally loaded. - /// - [Serializable] - public class TestPackage - { - /// - /// Construct a top-level TestPackage that wraps one or more - /// test files, contained as subpackages. - /// - /// Names of all the test files - /// - /// Semantically equivalent to the IList constructor. - /// - public TestPackage(params string[] testFiles) - { - InitializeSubPackages(testFiles); - } - - /// - /// Construct a top-level TestPackage that wraps one or more - /// test files, contained as subpackages. - /// - /// Names of all the test files. - /// - /// Semantically equivalent to the array constructor. - /// - public TestPackage(IList testFiles) - { - InitializeSubPackages(testFiles); - } - - private void InitializeSubPackages(IList testFiles) - { - foreach (string testFile in testFiles) - AddSubPackage(testFile); - } - - /// - /// Construct an empty TestPackage - /// - /// Used in deserializing a package from xml. - public TestPackage() - { - } - - private static int _nextID = 0; - - private static string GetNextID() - { - return (_nextID++).ToString(); - } - - /// - /// Every test package gets a unique ID used to prefix test IDs within that package. - /// - /// - /// The generated ID is only unique for packages created within the same application domain. - /// For that reason, NUnit pre-creates all test packages that will be needed. - /// - // TODO: Setter is temporarily public for use in deserialization. - // We should find a better solution for setting the ID. - public string ID { get; set; } = GetNextID(); - - /// - /// Gets the name of the package - /// - public string? Name - { - get { return FullName is null ? null : Path.GetFileName(FullName); } - } - - /// - /// Gets the path to the file containing tests. It may be - /// an assembly or a recognized project type. - /// - public string? FullName { get; set; } - - /// - /// Get a flag indicating whether this package represents an assembly. - /// - public bool IsAssemblyPackage - { - get - { - if (FullName is null) - return false; - - string extension = Path.GetExtension(FullName).ToLower(); - return extension == ".dll" || extension == ".exe"; - } - } - - /// - /// Get a flag indicating whether any subpackages exist - /// - public bool HasSubPackages => SubPackages.Count > 0; - - /// - /// Gets the list of SubPackages contained in this package - /// - public IList SubPackages { get; } = new List(); - - /// - /// Gets the settings dictionary for this package. - /// - public PackageSettings Settings { get; } = new PackageSettings(); - - /// - /// Add a subpackage to the package. - /// - /// The subpackage to be added - public void AddSubPackage(TestPackage subPackage) - { - SubPackages.Add(subPackage); - - foreach (var setting in Settings) - if (!subPackage.Settings.HasSetting(setting.Name)) - subPackage.AddSetting(setting); - } - - /// - /// Add a subpackage to the package, specifying its name. This is - /// the only way to add a named subpackage to the top-level package. - /// - /// The name of the subpackage to be added - public TestPackage AddSubPackage(string packageName) - { - var subPackage = new TestPackage() { FullName = Path.GetFullPath(packageName) }; - SubPackages.Add(subPackage); - - return subPackage; - } - - /// - /// Add a setting to a package and all of its subpackages. - /// - /// The setting to be added - /// - /// Once a package is created, subpackages may have been created - /// as well. If you add a setting directly to the Settings dictionary - /// of the package, the subpackages are not updated. This method is - /// used when the settings are intended to be reflected to all the - /// subpackages under the package. - /// - public void AddSetting(PackageSetting setting) - { - Settings.Add(setting); - foreach (var subPackage in SubPackages) - subPackage.AddSetting(setting); - } - - /// - /// Create and add a custom string setting to a package and all of its subpackages. - /// - /// The name of the setting. - /// The corresponding value to set. - /// - /// Once a package is created, subpackages may have been created - /// as well. If you add a setting directly to the Settings dictionary - /// of the package, the subpackages are not updated. This method is - /// used when the settings are intended to be reflected to all the - /// subpackages under the package. - /// - public void AddSetting(string name, string value) - { - AddSetting(new PackageSetting(name, value)); - } - - /// - /// Create and add a custom boolean setting to a package and all of its subpackages. - /// - /// The name of the setting. - /// The corresponding value to set. - /// - /// Once a package is created, subpackages may have been created - /// as well. If you add a setting directly to the Settings dictionary - /// of the package, the subpackages are not updated. This method is - /// used when the settings are intended to be reflected to all the - /// subpackages under the package. - /// - public void AddSetting(string name, bool value) - { - AddSetting(new PackageSetting(name, value)); - } - - /// - /// Create and add a custom int setting to a package and all of its subpackages. - /// - /// The name of the setting. - /// The corresponding value to set. - /// - /// Once a package is created, subpackages may have been created - /// as well. If you add a setting directly to the Settings dictionary - /// of the package, the subpackages are not updated. This method is - /// used when the settings are intended to be reflected to all the - /// subpackages under the package. - /// - public void AddSetting(string name, int value) - { - AddSetting(new PackageSetting(name, value)); - } - - /// - /// Predicate delegate for use with the Select method - /// - public delegate bool TestPackageSelectorDelegate(TestPackage p); - - /// - /// Select a list of all packages and subpackages matching a predicate - /// - /// - /// - public IList Select(TestPackageSelectorDelegate selector) - { - var selection = new List(); - - AccumulatePackages(this, selection, selector); - - return selection; - } - - private void AccumulatePackages(TestPackage package, IList selection, TestPackageSelectorDelegate selector) - { - if (selector(package)) - selection.Add(package); - - foreach (var subPackage in package.SubPackages) - AccumulatePackages(subPackage, selection, selector); - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/TestSelectionParserException.cs b/src/NUnitEngine/nunit.engine.api/TestSelectionParserException.cs deleted file mode 100644 index 264cee1dc..000000000 --- a/src/NUnitEngine/nunit.engine.api/TestSelectionParserException.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt - -using System; -using System.Runtime.Serialization; - -namespace NUnit.Engine -{ - /// - /// TestSelectionParserException is thrown when an error - /// is found while parsing the selection expression. - /// - [Serializable] - public class TestSelectionParserException : Exception - { - /// - /// Construct with a message - /// - public TestSelectionParserException(string message) : base(message) - { - } - - /// - /// Construct with a message and inner exception - /// - public TestSelectionParserException(string message, Exception innerException) : base(message, innerException) - { - } - - /// - /// Serialization constructor - /// - public TestSelectionParserException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/src/NUnitEngine/nunit.engine.api/nunit.engine.api.csproj b/src/NUnitEngine/nunit.engine.api/nunit.engine.api.csproj deleted file mode 100644 index 911fc0dc2..000000000 --- a/src/NUnitEngine/nunit.engine.api/nunit.engine.api.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - NUnit.Engine - net462;netstandard2.0 - true - - - - NUnit.Engine.Api - NUnit Engine API ($(TargetFramework)) - Defines the interfaces used by runners and engine extensions to access the NUnit Engine. Not normally needed by direct users who simply want to run tests. - - - - - - - diff --git a/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj b/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj index d8a8bfac7..1c2fc4378 100644 --- a/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj +++ b/src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj @@ -29,7 +29,6 @@ - diff --git a/src/NUnitEngine/nunit.engine/nunit.engine.csproj b/src/NUnitEngine/nunit.engine/nunit.engine.csproj index cee0c6e83..36d98b1c5 100644 --- a/src/NUnitEngine/nunit.engine/nunit.engine.csproj +++ b/src/NUnitEngine/nunit.engine/nunit.engine.csproj @@ -20,7 +20,10 @@ - + + + + \ No newline at end of file diff --git a/src/TestData/FakeExtensions/2.0/FakeExtensions.csproj b/src/TestData/FakeExtensions/2.0/FakeExtensions.csproj index 89ed51a07..e64081247 100644 --- a/src/TestData/FakeExtensions/2.0/FakeExtensions.csproj +++ b/src/TestData/FakeExtensions/2.0/FakeExtensions.csproj @@ -10,10 +10,13 @@ - + + + + PreserveNewest