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/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/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 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..7e3e2d9 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,57 +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 private const string FAKE_EXTENSIONS_FILENAME = "TestCentric.Extensibility.FakeExtensions.dll"; @@ -231,3 +231,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 @@ - - - - - - - - - - - - +