From b1e0d4a84616bcb89fb7f718d324b2357162635e Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Thu, 11 Sep 2025 14:51:46 -0700 Subject: [PATCH 1/3] Support NUnit Extensions --- GitVersion.yml | 2 +- build.cake | 6 +++--- nuget/TestCentric.Extensibility.Api.nuspec | 2 +- nuget/TestCentric.Extensibility.nuspec | 4 ++-- src/Directory.Build.props | 9 +++++++-- .../FakeExtensions.cs | 7 +++++-- .../ExtensionManagerTests.cs | 18 +++++++++++++----- .../ExtensionManager.cs | 10 +++++++--- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index df19ec1..6ba68be 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 4.0.0 +next-version: 3.3.0 mode: ContinuousDelivery branches: master: diff --git a/build.cake b/build.cake index f27b8e4..ef066b7 100644 --- a/build.cake +++ b/build.cake @@ -19,8 +19,8 @@ BuildSettings.Packages.Add(new NuGetPackage( source: "nuget/TestCentric.Extensibility.nuspec", checks: new PackageCheck[] { HasFiles("LICENSE.txt", "README.md", "testcentric.png"), - HasDirectory("lib/net20") - .WithFiles("TestCentric.Extensibility.dll", "TestCentric.Extensibility.api.dll", "nunit.engine.api.dll"), + //HasDirectory("lib/net20") + // .WithFiles("TestCentric.Extensibility.dll", "TestCentric.Extensibility.api.dll", "nunit.engine.api.dll"), HasDirectory("lib/net462") .WithFiles("testcentric.extensibility.dll", "TestCentric.Extensibility.api.dll", "nunit.engine.api.dll"), HasDirectory("lib/netstandard2.0") @@ -49,7 +49,7 @@ BuildSettings.Packages.Add(new NuGetPackage( checks: new PackageCheck[] { HasFiles( "LICENSE.txt", "README.md", "testcentric.png", - "lib/net20/testcentric.extensibility.api.dll", + //"lib/net20/testcentric.extensibility.api.dll", "lib/net462/testcentric.extensibility.api.dll", "lib/netstandard2.0/testcentric.extensibility.api.dll") })); diff --git a/nuget/TestCentric.Extensibility.Api.nuspec b/nuget/TestCentric.Extensibility.Api.nuspec index 9f4372c..53fef6e 100644 --- a/nuget/TestCentric.Extensibility.Api.nuspec +++ b/nuget/TestCentric.Extensibility.Api.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nuget/TestCentric.Extensibility.nuspec b/nuget/TestCentric.Extensibility.nuspec index dfc229d..9121333 100644 --- a/nuget/TestCentric.Extensibility.nuspec +++ b/nuget/TestCentric.Extensibility.nuspec @@ -22,11 +22,11 @@ - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ef2d246..00aa9fd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -26,7 +26,6 @@ 2.0.0-dev01659 3.0.4 1.2.1 - 3.16.2 TestCentric TestCentric Gui Runner and Engine @@ -36,6 +35,11 @@ 0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7 + + + 3.16.2 + + 4.1.0 5.3.0 + 4.0.0-beta.1.1 diff --git a/src/testcentric.extensibility.fakes/FakeExtensions.cs b/src/testcentric.extensibility.fakes/FakeExtensions.cs index d0bef41..720fbd2 100644 --- a/src/testcentric.extensibility.fakes/FakeExtensions.cs +++ b/src/testcentric.extensibility.fakes/FakeExtensions.cs @@ -113,8 +113,11 @@ public void OnTestEvent(string text) namespace NUnit.Engine.Extensibility { - //[Extension(Path = "/NUnit/Engine/TypeExtensions/IProjectLoader/")] - [Extension] +#if NET20 + [NUnit.Engine.Extensibility.Extension] +#else + [NUnit.Extensibility.Extension] +#endif public class FakeProjectLoader : IProjectLoader { public bool CanLoadFrom(string path) diff --git a/src/testcentric.extensibility.tests/ExtensionManagerTests.cs b/src/testcentric.extensibility.tests/ExtensionManagerTests.cs index 57b66f8..887a8fa 100644 --- a/src/testcentric.extensibility.tests/ExtensionManagerTests.cs +++ b/src/testcentric.extensibility.tests/ExtensionManagerTests.cs @@ -41,8 +41,11 @@ public ExtensionManagerTests(string defaultTypeExtensionsPath) "/NUnit/Engine/TypeExtensions/ITestEventListener", "/NUnit/Engine/TypeExtensions/IService", "/NUnit/Engine/TypeExtensions/IDriverFactory", + "/NUnit/Engine/TypeExtensions/IResultWriter", "/NUnit/Engine/TypeExtensions/IProjectLoader", - "/NUnit/Engine/TypeExtensions/IResultWriter" +#if !NET35 + "/NUnit/Engine/TypeExtensions/IAgentLauncher" +#endif }; // This could be initialized inline, but it's here for clarity @@ -57,8 +60,11 @@ public ExtensionManagerTests(string defaultTypeExtensionsPath) typeof(NUnit.Engine.ITestEventListener), typeof(NUnit.Engine.IService), typeof(NUnit.Engine.Extensibility.IDriverFactory), + typeof(NUnit.Engine.Extensibility.IResultWriter), typeof(NUnit.Engine.Extensibility.IProjectLoader), - typeof(NUnit.Engine.Extensibility.IResultWriter) +#if !NET35 + typeof(NUnit.Engine.Extensibility.IAgentLauncher) +#endif }; } @@ -144,7 +150,9 @@ internal class ThisIsNotAnExtensionPoint "TestCentric.Engine.Extensibility.FakeAgentLauncher", "TestCentric.Engine.Extensibility.FakeTestEventListener", "TestCentric.Engine.Extensibility.FakeExtension_ThrowsInConstructor", +#if !NET35 "NUnit.Engine.Extensibility.FakeProjectLoader" +#endif ]; [Test] @@ -189,15 +197,15 @@ public void ExtensionThrowsInConstructor() #if NETCOREAPP [TestCase("netstandard2.0", ExpectedResult = true)] [TestCase("net462", ExpectedResult = false)] - [TestCase("net20", ExpectedResult = false)] + //[TestCase("net20", ExpectedResult = false)] #elif NET40_OR_GREATER [TestCase("netstandard2.0", ExpectedResult = false)] [TestCase("net462", ExpectedResult = true)] - [TestCase("net20", ExpectedResult = true)] + //[TestCase("net20", ExpectedResult = true)] #else [TestCase("netstandard2.0", ExpectedResult = false)] [TestCase("net462", ExpectedResult = false)] - [TestCase("net20", ExpectedResult = true)] + //[TestCase("net20", ExpectedResult = true)] #endif public bool LoadTargetFramework(string tfm) { diff --git a/src/testcentric.extensibility/ExtensionManager.cs b/src/testcentric.extensibility/ExtensionManager.cs index 150584e..0662683 100644 --- a/src/testcentric.extensibility/ExtensionManager.cs +++ b/src/testcentric.extensibility/ExtensionManager.cs @@ -9,7 +9,11 @@ using System.Reflection; using TestCentric.Metadata; +#if NET20 using NUNIT = NUnit.Engine.Extensibility; +#else +using NUNIT = NUnit.Extensibility; +#endif namespace TestCentric.Extensibility { @@ -34,9 +38,9 @@ public class ExtensionManager private const string TESTCENTRIC_EXTENSION_ATTRIBUTE = "TestCentric.Extensibility.ExtensionAttribute"; private const string TESTCENTRIC_EXTENSION_PROPERTY_ATTRIBUTE = "TestCentric.Extensibility.ExtensionPropertyAttribute"; - // TODO: These are NUnit V3 attributes. We should support as well - private const string NUNIT_EXTENSION_ATTRIBUTE = "NUnit.Engine.Extensibility.ExtensionAttribute"; - private const string NUNIT_EXTENSION_PROPERTY_ATTRIBUTE = "NUnit.Engine.Extensibility.ExtensionPropertyAttribute"; + // TODO: These are NUnit V4 attributes. + private const string NUNIT_EXTENSION_ATTRIBUTE = "NUnit.Extensibility.ExtensionAttribute"; + private const string NUNIT_EXTENSION_PROPERTY_ATTRIBUTE = "NUnit.Extensibility.ExtensionPropertyAttribute"; // List of all ExtensionPoints discovered private readonly List _extensionPoints = new List(); From 52e7376fd30a3d64f4a053551456be68bf99ca8e Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Sun, 14 Sep 2025 10:02:57 -0700 Subject: [PATCH 2/3] Update recipe --- NuGet.config | 3 ++- build.cake | 2 +- src/Directory.Build.props | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NuGet.config b/NuGet.config index ceb1e2b..1e5ebaa 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,6 +4,7 @@ - + + \ No newline at end of file diff --git a/build.cake b/build.cake index ef066b7..918870b 100644 --- a/build.cake +++ b/build.cake @@ -1,5 +1,5 @@ // Load the recipe -#load nuget:?package=TestCentric.Cake.Recipe&version=1.4.1-dev00004 +#load nuget:?package=TestCentric.Cake.Recipe&version=1.4.1-dev00005 // Comment out above line and uncomment below for local tests of recipe changes //#load ../TestCentric.Cake.Recipe/recipe/*.cake diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 00aa9fd..d7dc774 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -23,7 +23,7 @@ true 8.0.0 - 2.0.0-dev01659 + 2.0.0-dev01905 3.0.4 1.2.1 From a264f5df98a4ae834abc5eb3677136a19bb19631 Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Mon, 15 Sep 2025 01:54:50 -0700 Subject: [PATCH 3/3] Partial fix to issue 64 --- GitVersion.yml | 2 +- TestCentric.Extensibility.sln | 12 +- .../FakeExtensions.cs | 196 +++++++++--------- .../ExtensionManagerTests.cs | 112 +++++----- .../testcentric.extensibility.tests.csproj | 13 +- 5 files changed, 163 insertions(+), 172 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 6ba68be..df19ec1 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 3.3.0 +next-version: 4.0.0 mode: ContinuousDelivery branches: master: diff --git a/TestCentric.Extensibility.sln b/TestCentric.Extensibility.sln index a75ecd7..8d114e5 100644 --- a/TestCentric.Extensibility.sln +++ b/TestCentric.Extensibility.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility", "src\testcentric.extensibility\TestCentric.Extensibility.csproj", "{885A9279-CED3-4007-A6E8-AC0D33E2C929}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility.Tests", "src\testcentric.extensibility.tests\TestCentric.Extensibility.Tests.csproj", "{DD83C188-C0A1-415D-BFB5-A1771282D38B}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BF7211F-5504-465B-AAB8-E73860BD6A11}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore @@ -39,6 +37,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility.FakeExtensions", "src\testcentric.extensibility.fakes\TestCentric.Extensibility.FakeExtensions.csproj", "{B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testcentric.extensibility.tests", "src\testcentric.extensibility.tests\testcentric.extensibility.tests.csproj", "{90FDC02B-9261-DCFA-9DF0-AB22116366A2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,10 +49,6 @@ Global {885A9279-CED3-4007-A6E8-AC0D33E2C929}.Debug|Any CPU.Build.0 = Debug|Any CPU {885A9279-CED3-4007-A6E8-AC0D33E2C929}.Release|Any CPU.ActiveCfg = Release|Any CPU {885A9279-CED3-4007-A6E8-AC0D33E2C929}.Release|Any CPU.Build.0 = Release|Any CPU - {DD83C188-C0A1-415D-BFB5-A1771282D38B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DD83C188-C0A1-415D-BFB5-A1771282D38B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD83C188-C0A1-415D-BFB5-A1771282D38B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD83C188-C0A1-415D-BFB5-A1771282D38B}.Release|Any CPU.Build.0 = Release|Any CPU {BE988F0A-3337-4DC6-8915-138C4875FD04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BE988F0A-3337-4DC6-8915-138C4875FD04}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE988F0A-3337-4DC6-8915-138C4875FD04}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -61,6 +57,10 @@ Global {B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Debug|Any CPU.Build.0 = Debug|Any CPU {B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Release|Any CPU.ActiveCfg = Release|Any CPU {B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Release|Any CPU.Build.0 = Release|Any CPU + {90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/testcentric.extensibility.fakes/FakeExtensions.cs b/src/testcentric.extensibility.fakes/FakeExtensions.cs index 720fbd2..91244ff 100644 --- a/src/testcentric.extensibility.fakes/FakeExtensions.cs +++ b/src/testcentric.extensibility.fakes/FakeExtensions.cs @@ -12,104 +12,104 @@ using System.Xml; using System.IO; -namespace TestCentric.Engine.Extensibility -{ - // Extensions - - [Extension(Enabled = false)] - public class FakeTestEventListener : ITestEventListener - { - public void OnTestEvent(string text) - { - throw new System.NotImplementedException(); - } - } - - //[Extension] - public class FakeService : IService - { - public IServiceLocator ServiceContext { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - - public ServiceStatus Status => throw new System.NotImplementedException(); - - public void StartService() - { - throw new System.NotImplementedException(); - } - - public void StopService() - { - throw new System.NotImplementedException(); - } - } - - [Extension] - public class FakeAgentLauncher : TestCentric.Engine.Extensibility.IAgentLauncher - { - public TestAgentInfo AgentInfo => throw new NotImplementedException(); - - public bool CanCreateProcess(TestPackage package) - { - throw new NotImplementedException(); - } - - public Process CreateProcess(Guid agentId, string agencyUrl, TestPackage package) - { - throw new NotImplementedException(); - } - } - - //[Extension] - public class FakeDriverFactory : IDriverFactory - { -#if NETFRAMEWORK - public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference) -#else - public IFrameworkDriver GetDriver(AssemblyName reference) -#endif - { - throw new NotImplementedException(); - } - - public bool IsSupportedTestFramework(AssemblyName reference) - { - throw new NotImplementedException(); - } - } - - //[Extension] - public class FakeResultWriter : IResultWriter - { - public void CheckWritability(string outputPath) - { - throw new NotImplementedException(); - } - - public void WriteResultFile(XmlNode resultNode, string outputPath) - { - throw new NotImplementedException(); - } - - public void WriteResultFile(XmlNode resultNode, TextWriter writer) - { - throw new NotImplementedException(); - } - } - - [Extension(Enabled = false)] - public class FakeExtension_ThrowsInConstructor : ITestEventListener - { - public FakeExtension_ThrowsInConstructor() - { - throw new NotImplementedException(); - } - - public void OnTestEvent(string text) - { - throw new System.NotImplementedException(); - } - } -} +//namespace TestCentric.Engine.Extensibility +//{ +// // Extensions + +// //[Extension(Enabled = false)] +// public class FakeTestEventListener : ITestEventListener +// { +// public void OnTestEvent(string text) +// { +// throw new System.NotImplementedException(); +// } +// } + +// //[Extension] +// public class FakeService : IService +// { +// public IServiceLocator ServiceContext { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } + +// public ServiceStatus Status => throw new System.NotImplementedException(); + +// public void StartService() +// { +// throw new System.NotImplementedException(); +// } + +// public void StopService() +// { +// throw new System.NotImplementedException(); +// } +// } + +// //[Extension] +// public class FakeAgentLauncher : TestCentric.Engine.Extensibility.IAgentLauncher +// { +// public TestAgentInfo AgentInfo => throw new NotImplementedException(); + +// public bool CanCreateProcess(TestPackage package) +// { +// throw new NotImplementedException(); +// } + +// public Process CreateProcess(Guid agentId, string agencyUrl, TestPackage package) +// { +// throw new NotImplementedException(); +// } +// } + +// //[Extension] +// public class FakeDriverFactory : IDriverFactory +// { +//#if NETFRAMEWORK +// public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference) +//#else +// public IFrameworkDriver GetDriver(AssemblyName reference) +//#endif +// { +// throw new NotImplementedException(); +// } + +// public bool IsSupportedTestFramework(AssemblyName reference) +// { +// throw new NotImplementedException(); +// } +// } + +// //[Extension] +// public class FakeResultWriter : IResultWriter +// { +// public void CheckWritability(string outputPath) +// { +// throw new NotImplementedException(); +// } + +// public void WriteResultFile(XmlNode resultNode, string outputPath) +// { +// throw new NotImplementedException(); +// } + +// public void WriteResultFile(XmlNode resultNode, TextWriter writer) +// { +// throw new NotImplementedException(); +// } +// } + +// //[Extension(Enabled = false)] +// public class FakeExtension_ThrowsInConstructor : ITestEventListener +// { +// public FakeExtension_ThrowsInConstructor() +// { +// throw new NotImplementedException(); +// } + +// public void OnTestEvent(string text) +// { +// throw new System.NotImplementedException(); +// } +// } +//} namespace NUnit.Engine.Extensibility { diff --git a/src/testcentric.extensibility.tests/ExtensionManagerTests.cs b/src/testcentric.extensibility.tests/ExtensionManagerTests.cs index 887a8fa..77d22d3 100644 --- a/src/testcentric.extensibility.tests/ExtensionManagerTests.cs +++ b/src/testcentric.extensibility.tests/ExtensionManagerTests.cs @@ -3,6 +3,7 @@ // Licensed under the MIT License. See LICENSE file in root directory. // *********************************************************************** +#if false // TODO: Re-design this test fixture using NUnit.Framework; using System; using System.IO; @@ -38,11 +39,11 @@ public ExtensionManagerTests(string defaultTypeExtensionsPath) prefix + "IDriverFactory", prefix + "IProjectLoader", prefix + "IResultWriter", - "/NUnit/Engine/TypeExtensions/ITestEventListener", - "/NUnit/Engine/TypeExtensions/IService", - "/NUnit/Engine/TypeExtensions/IDriverFactory", - "/NUnit/Engine/TypeExtensions/IResultWriter", - "/NUnit/Engine/TypeExtensions/IProjectLoader", + //"/NUnit/Engine/TypeExtensions/ITestEventListener", + //"/NUnit/Engine/TypeExtensions/IService", + //"/NUnit/Engine/TypeExtensions/IDriverFactory", + //"/NUnit/Engine/TypeExtensions/IResultWriter", + //"/NUnit/Engine/TypeExtensions/IProjectLoader", #if !NET35 "/NUnit/Engine/TypeExtensions/IAgentLauncher" #endif @@ -161,56 +162,56 @@ public void AllExtensionsAreKnown() Assert.That(ExtensionManager.Extensions.Select(ep => ep.TypeName), Is.EquivalentTo(KnownExtensionTypeNames)); } - // Run this first as subsequent test will enable the extension - [Test, Order(1)] - public void ExtensionMayBeDisabledByDefault() - { - Assert.That(ExtensionManager.Extensions, - Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener") - .And.Property(nameof(ExtensionNode.Enabled)).False); - } - - [Test] - public void DisabledExtensionMayBeEnabled() - { - ExtensionManager.EnableExtension("TestCentric.Engine.Extensibility.FakeTestEventListener", true); - - Assert.That(ExtensionManager.Extensions, - Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener") - .And.Property(nameof(ExtensionNode.Enabled)).True); - } - - [Test] - public void ExtensionThrowsInConstructor() - { - string typeName = "TestCentric.Engine.Extensibility.FakeExtension_ThrowsInConstructor"; - var exNode = ExtensionManager.Extensions.Where(n => n.TypeName == typeName).Single(); - - // Although the constructor throws, we don't get an exception. - // However, the node contains the error information. - Assert.DoesNotThrow(() => { var o = exNode.ExtensionObject; }); - Assert.That(exNode.Status, Is.EqualTo(ExtensionStatus.Error)); - Assert.That(exNode.Exception, Is.InstanceOf()); - Assert.That(exNode.Exception.InnerException, Is.InstanceOf()); - } - -#if NETCOREAPP - [TestCase("netstandard2.0", ExpectedResult = true)] - [TestCase("net462", ExpectedResult = false)] - //[TestCase("net20", ExpectedResult = false)] -#elif NET40_OR_GREATER - [TestCase("netstandard2.0", ExpectedResult = false)] - [TestCase("net462", ExpectedResult = true)] - //[TestCase("net20", ExpectedResult = true)] -#else - [TestCase("netstandard2.0", ExpectedResult = false)] - [TestCase("net462", ExpectedResult = false)] - //[TestCase("net20", ExpectedResult = true)] -#endif - public bool LoadTargetFramework(string tfm) - { - return ExtensionManager.CanLoadTargetFramework(THIS_ASSEMBLY, FakeExtensions(tfm)); - } + //// Run this first as subsequent test will enable the extension + //[Test, Order(1)] + //public void ExtensionMayBeDisabledByDefault() + //{ + // Assert.That(ExtensionManager.Extensions, + // Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener") + // .And.Property(nameof(ExtensionNode.Enabled)).False); + //} + + //[Test] + //public void DisabledExtensionMayBeEnabled() + //{ + // ExtensionManager.EnableExtension("TestCentric.Engine.Extensibility.FakeTestEventListener", true); + + // Assert.That(ExtensionManager.Extensions, + // Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener") + // .And.Property(nameof(ExtensionNode.Enabled)).True); + //} + + //[Test] + //public void ExtensionThrowsInConstructor() + //{ + // string typeName = "TestCentric.Engine.Extensibility.FakeExtension_ThrowsInConstructor"; + // var exNode = ExtensionManager.Extensions.Where(n => n.TypeName == typeName).Single(); + + // // Although the constructor throws, we don't get an exception. + // // However, the node contains the error information. + // Assert.DoesNotThrow(() => { var o = exNode.ExtensionObject; }); + // Assert.That(exNode.Status, Is.EqualTo(ExtensionStatus.Error)); + // Assert.That(exNode.Exception, Is.InstanceOf()); + // Assert.That(exNode.Exception.InnerException, Is.InstanceOf()); + //} + +//#if NETCOREAPP +// [TestCase("netstandard2.0", ExpectedResult = true)] +// [TestCase("net462", ExpectedResult = false)] +// //[TestCase("net20", ExpectedResult = false)] +//#elif NET40_OR_GREATER +// [TestCase("netstandard2.0", ExpectedResult = false)] +// [TestCase("net462", ExpectedResult = true)] +// //[TestCase("net20", ExpectedResult = true)] +//#else +// [TestCase("netstandard2.0", ExpectedResult = false)] +// [TestCase("net462", ExpectedResult = false)] +// //[TestCase("net20", ExpectedResult = true)] +//#endif +// public bool LoadTargetFramework(string tfm) +// { +// return ExtensionManager.CanLoadTargetFramework(THIS_ASSEMBLY, FakeExtensions(tfm)); +// } #endregion @@ -231,3 +232,4 @@ private static ExtensionAssembly FakeExtensions(string tfm) } } } +#endif diff --git a/src/testcentric.extensibility.tests/testcentric.extensibility.tests.csproj b/src/testcentric.extensibility.tests/testcentric.extensibility.tests.csproj index 25b8f2f..102dd49 100644 --- a/src/testcentric.extensibility.tests/testcentric.extensibility.tests.csproj +++ b/src/testcentric.extensibility.tests/testcentric.extensibility.tests.csproj @@ -16,21 +16,10 @@ - - - - - - - - - - - - +