Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit a264f5d

Browse files
committed
Partial fix to issue 64
1 parent 52e7376 commit a264f5d

File tree

5 files changed

+163
-172
lines changed

5 files changed

+163
-172
lines changed

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
next-version: 3.3.0
1+
next-version: 4.0.0
22
mode: ContinuousDelivery
33
branches:
44
master:

TestCentric.Extensibility.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.5.33530.505
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility", "src\testcentric.extensibility\TestCentric.Extensibility.csproj", "{885A9279-CED3-4007-A6E8-AC0D33E2C929}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility.Tests", "src\testcentric.extensibility.tests\TestCentric.Extensibility.Tests.csproj", "{DD83C188-C0A1-415D-BFB5-A1771282D38B}"
9-
EndProject
108
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BF7211F-5504-465B-AAB8-E73860BD6A11}"
119
ProjectSection(SolutionItems) = preProject
1210
.gitignore = .gitignore
@@ -39,6 +37,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
3937
EndProject
4038
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCentric.Extensibility.FakeExtensions", "src\testcentric.extensibility.fakes\TestCentric.Extensibility.FakeExtensions.csproj", "{B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}"
4139
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testcentric.extensibility.tests", "src\testcentric.extensibility.tests\testcentric.extensibility.tests.csproj", "{90FDC02B-9261-DCFA-9DF0-AB22116366A2}"
41+
EndProject
4242
Global
4343
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4444
Debug|Any CPU = Debug|Any CPU
@@ -49,10 +49,6 @@ Global
4949
{885A9279-CED3-4007-A6E8-AC0D33E2C929}.Debug|Any CPU.Build.0 = Debug|Any CPU
5050
{885A9279-CED3-4007-A6E8-AC0D33E2C929}.Release|Any CPU.ActiveCfg = Release|Any CPU
5151
{885A9279-CED3-4007-A6E8-AC0D33E2C929}.Release|Any CPU.Build.0 = Release|Any CPU
52-
{DD83C188-C0A1-415D-BFB5-A1771282D38B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53-
{DD83C188-C0A1-415D-BFB5-A1771282D38B}.Debug|Any CPU.Build.0 = Debug|Any CPU
54-
{DD83C188-C0A1-415D-BFB5-A1771282D38B}.Release|Any CPU.ActiveCfg = Release|Any CPU
55-
{DD83C188-C0A1-415D-BFB5-A1771282D38B}.Release|Any CPU.Build.0 = Release|Any CPU
5652
{BE988F0A-3337-4DC6-8915-138C4875FD04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5753
{BE988F0A-3337-4DC6-8915-138C4875FD04}.Debug|Any CPU.Build.0 = Debug|Any CPU
5854
{BE988F0A-3337-4DC6-8915-138C4875FD04}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -61,6 +57,10 @@ Global
6157
{B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Debug|Any CPU.Build.0 = Debug|Any CPU
6258
{B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Release|Any CPU.ActiveCfg = Release|Any CPU
6359
{B15F3AB7-7930-4FE5-A2CC-DB61F8CFC275}.Release|Any CPU.Build.0 = Release|Any CPU
60+
{90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61+
{90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
62+
{90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{90FDC02B-9261-DCFA-9DF0-AB22116366A2}.Release|Any CPU.Build.0 = Release|Any CPU
6464
EndGlobalSection
6565
GlobalSection(SolutionProperties) = preSolution
6666
HideSolutionNode = FALSE

src/testcentric.extensibility.fakes/FakeExtensions.cs

Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -12,104 +12,104 @@
1212
using System.Xml;
1313
using System.IO;
1414

15-
namespace TestCentric.Engine.Extensibility
16-
{
17-
// Extensions
18-
19-
[Extension(Enabled = false)]
20-
public class FakeTestEventListener : ITestEventListener
21-
{
22-
public void OnTestEvent(string text)
23-
{
24-
throw new System.NotImplementedException();
25-
}
26-
}
27-
28-
//[Extension]
29-
public class FakeService : IService
30-
{
31-
public IServiceLocator ServiceContext { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
32-
33-
public ServiceStatus Status => throw new System.NotImplementedException();
34-
35-
public void StartService()
36-
{
37-
throw new System.NotImplementedException();
38-
}
39-
40-
public void StopService()
41-
{
42-
throw new System.NotImplementedException();
43-
}
44-
}
45-
46-
[Extension]
47-
public class FakeAgentLauncher : TestCentric.Engine.Extensibility.IAgentLauncher
48-
{
49-
public TestAgentInfo AgentInfo => throw new NotImplementedException();
50-
51-
public bool CanCreateProcess(TestPackage package)
52-
{
53-
throw new NotImplementedException();
54-
}
55-
56-
public Process CreateProcess(Guid agentId, string agencyUrl, TestPackage package)
57-
{
58-
throw new NotImplementedException();
59-
}
60-
}
61-
62-
//[Extension]
63-
public class FakeDriverFactory : IDriverFactory
64-
{
65-
#if NETFRAMEWORK
66-
public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference)
67-
#else
68-
public IFrameworkDriver GetDriver(AssemblyName reference)
69-
#endif
70-
{
71-
throw new NotImplementedException();
72-
}
73-
74-
public bool IsSupportedTestFramework(AssemblyName reference)
75-
{
76-
throw new NotImplementedException();
77-
}
78-
}
79-
80-
//[Extension]
81-
public class FakeResultWriter : IResultWriter
82-
{
83-
public void CheckWritability(string outputPath)
84-
{
85-
throw new NotImplementedException();
86-
}
87-
88-
public void WriteResultFile(XmlNode resultNode, string outputPath)
89-
{
90-
throw new NotImplementedException();
91-
}
92-
93-
public void WriteResultFile(XmlNode resultNode, TextWriter writer)
94-
{
95-
throw new NotImplementedException();
96-
}
97-
}
98-
99-
[Extension(Enabled = false)]
100-
public class FakeExtension_ThrowsInConstructor : ITestEventListener
101-
{
102-
public FakeExtension_ThrowsInConstructor()
103-
{
104-
throw new NotImplementedException();
105-
}
106-
107-
public void OnTestEvent(string text)
108-
{
109-
throw new System.NotImplementedException();
110-
}
111-
}
112-
}
15+
//namespace TestCentric.Engine.Extensibility
16+
//{
17+
// // Extensions
18+
19+
// //[Extension(Enabled = false)]
20+
// public class FakeTestEventListener : ITestEventListener
21+
// {
22+
// public void OnTestEvent(string text)
23+
// {
24+
// throw new System.NotImplementedException();
25+
// }
26+
// }
27+
28+
// //[Extension]
29+
// public class FakeService : IService
30+
// {
31+
// public IServiceLocator ServiceContext { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
32+
33+
// public ServiceStatus Status => throw new System.NotImplementedException();
34+
35+
// public void StartService()
36+
// {
37+
// throw new System.NotImplementedException();
38+
// }
39+
40+
// public void StopService()
41+
// {
42+
// throw new System.NotImplementedException();
43+
// }
44+
// }
45+
46+
// //[Extension]
47+
// public class FakeAgentLauncher : TestCentric.Engine.Extensibility.IAgentLauncher
48+
// {
49+
// public TestAgentInfo AgentInfo => throw new NotImplementedException();
50+
51+
// public bool CanCreateProcess(TestPackage package)
52+
// {
53+
// throw new NotImplementedException();
54+
// }
55+
56+
// public Process CreateProcess(Guid agentId, string agencyUrl, TestPackage package)
57+
// {
58+
// throw new NotImplementedException();
59+
// }
60+
// }
61+
62+
// //[Extension]
63+
// public class FakeDriverFactory : IDriverFactory
64+
// {
65+
//#if NETFRAMEWORK
66+
// public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference)
67+
//#else
68+
// public IFrameworkDriver GetDriver(AssemblyName reference)
69+
//#endif
70+
// {
71+
// throw new NotImplementedException();
72+
// }
73+
74+
// public bool IsSupportedTestFramework(AssemblyName reference)
75+
// {
76+
// throw new NotImplementedException();
77+
// }
78+
// }
79+
80+
// //[Extension]
81+
// public class FakeResultWriter : IResultWriter
82+
// {
83+
// public void CheckWritability(string outputPath)
84+
// {
85+
// throw new NotImplementedException();
86+
// }
87+
88+
// public void WriteResultFile(XmlNode resultNode, string outputPath)
89+
// {
90+
// throw new NotImplementedException();
91+
// }
92+
93+
// public void WriteResultFile(XmlNode resultNode, TextWriter writer)
94+
// {
95+
// throw new NotImplementedException();
96+
// }
97+
// }
98+
99+
// //[Extension(Enabled = false)]
100+
// public class FakeExtension_ThrowsInConstructor : ITestEventListener
101+
// {
102+
// public FakeExtension_ThrowsInConstructor()
103+
// {
104+
// throw new NotImplementedException();
105+
// }
106+
107+
// public void OnTestEvent(string text)
108+
// {
109+
// throw new System.NotImplementedException();
110+
// }
111+
// }
112+
//}
113113

114114
namespace NUnit.Engine.Extensibility
115115
{

src/testcentric.extensibility.tests/ExtensionManagerTests.cs

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Licensed under the MIT License. See LICENSE file in root directory.
44
// ***********************************************************************
55

6+
#if false // TODO: Re-design this test fixture
67
using NUnit.Framework;
78
using System;
89
using System.IO;
@@ -38,11 +39,11 @@ public ExtensionManagerTests(string defaultTypeExtensionsPath)
3839
prefix + "IDriverFactory",
3940
prefix + "IProjectLoader",
4041
prefix + "IResultWriter",
41-
"/NUnit/Engine/TypeExtensions/ITestEventListener",
42-
"/NUnit/Engine/TypeExtensions/IService",
43-
"/NUnit/Engine/TypeExtensions/IDriverFactory",
44-
"/NUnit/Engine/TypeExtensions/IResultWriter",
45-
"/NUnit/Engine/TypeExtensions/IProjectLoader",
42+
//"/NUnit/Engine/TypeExtensions/ITestEventListener",
43+
//"/NUnit/Engine/TypeExtensions/IService",
44+
//"/NUnit/Engine/TypeExtensions/IDriverFactory",
45+
//"/NUnit/Engine/TypeExtensions/IResultWriter",
46+
//"/NUnit/Engine/TypeExtensions/IProjectLoader",
4647
#if !NET35
4748
"/NUnit/Engine/TypeExtensions/IAgentLauncher"
4849
#endif
@@ -161,56 +162,56 @@ public void AllExtensionsAreKnown()
161162
Assert.That(ExtensionManager.Extensions.Select(ep => ep.TypeName), Is.EquivalentTo(KnownExtensionTypeNames));
162163
}
163164

164-
// Run this first as subsequent test will enable the extension
165-
[Test, Order(1)]
166-
public void ExtensionMayBeDisabledByDefault()
167-
{
168-
Assert.That(ExtensionManager.Extensions,
169-
Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener")
170-
.And.Property(nameof(ExtensionNode.Enabled)).False);
171-
}
172-
173-
[Test]
174-
public void DisabledExtensionMayBeEnabled()
175-
{
176-
ExtensionManager.EnableExtension("TestCentric.Engine.Extensibility.FakeTestEventListener", true);
177-
178-
Assert.That(ExtensionManager.Extensions,
179-
Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener")
180-
.And.Property(nameof(ExtensionNode.Enabled)).True);
181-
}
182-
183-
[Test]
184-
public void ExtensionThrowsInConstructor()
185-
{
186-
string typeName = "TestCentric.Engine.Extensibility.FakeExtension_ThrowsInConstructor";
187-
var exNode = ExtensionManager.Extensions.Where(n => n.TypeName == typeName).Single();
188-
189-
// Although the constructor throws, we don't get an exception.
190-
// However, the node contains the error information.
191-
Assert.DoesNotThrow(() => { var o = exNode.ExtensionObject; });
192-
Assert.That(exNode.Status, Is.EqualTo(ExtensionStatus.Error));
193-
Assert.That(exNode.Exception, Is.InstanceOf<ExtensibilityException>());
194-
Assert.That(exNode.Exception.InnerException, Is.InstanceOf<NotImplementedException>());
195-
}
196-
197-
#if NETCOREAPP
198-
[TestCase("netstandard2.0", ExpectedResult = true)]
199-
[TestCase("net462", ExpectedResult = false)]
200-
//[TestCase("net20", ExpectedResult = false)]
201-
#elif NET40_OR_GREATER
202-
[TestCase("netstandard2.0", ExpectedResult = false)]
203-
[TestCase("net462", ExpectedResult = true)]
204-
//[TestCase("net20", ExpectedResult = true)]
205-
#else
206-
[TestCase("netstandard2.0", ExpectedResult = false)]
207-
[TestCase("net462", ExpectedResult = false)]
208-
//[TestCase("net20", ExpectedResult = true)]
209-
#endif
210-
public bool LoadTargetFramework(string tfm)
211-
{
212-
return ExtensionManager.CanLoadTargetFramework(THIS_ASSEMBLY, FakeExtensions(tfm));
213-
}
165+
//// Run this first as subsequent test will enable the extension
166+
//[Test, Order(1)]
167+
//public void ExtensionMayBeDisabledByDefault()
168+
//{
169+
// Assert.That(ExtensionManager.Extensions,
170+
// Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener")
171+
// .And.Property(nameof(ExtensionNode.Enabled)).False);
172+
//}
173+
174+
//[Test]
175+
//public void DisabledExtensionMayBeEnabled()
176+
//{
177+
// ExtensionManager.EnableExtension("TestCentric.Engine.Extensibility.FakeTestEventListener", true);
178+
179+
// Assert.That(ExtensionManager.Extensions,
180+
// Has.One.Property(nameof(ExtensionNode.TypeName)).EqualTo("TestCentric.Engine.Extensibility.FakeTestEventListener")
181+
// .And.Property(nameof(ExtensionNode.Enabled)).True);
182+
//}
183+
184+
//[Test]
185+
//public void ExtensionThrowsInConstructor()
186+
//{
187+
// string typeName = "TestCentric.Engine.Extensibility.FakeExtension_ThrowsInConstructor";
188+
// var exNode = ExtensionManager.Extensions.Where(n => n.TypeName == typeName).Single();
189+
190+
// // Although the constructor throws, we don't get an exception.
191+
// // However, the node contains the error information.
192+
// Assert.DoesNotThrow(() => { var o = exNode.ExtensionObject; });
193+
// Assert.That(exNode.Status, Is.EqualTo(ExtensionStatus.Error));
194+
// Assert.That(exNode.Exception, Is.InstanceOf<ExtensibilityException>());
195+
// Assert.That(exNode.Exception.InnerException, Is.InstanceOf<NotImplementedException>());
196+
//}
197+
198+
//#if NETCOREAPP
199+
// [TestCase("netstandard2.0", ExpectedResult = true)]
200+
// [TestCase("net462", ExpectedResult = false)]
201+
// //[TestCase("net20", ExpectedResult = false)]
202+
//#elif NET40_OR_GREATER
203+
// [TestCase("netstandard2.0", ExpectedResult = false)]
204+
// [TestCase("net462", ExpectedResult = true)]
205+
// //[TestCase("net20", ExpectedResult = true)]
206+
//#else
207+
// [TestCase("netstandard2.0", ExpectedResult = false)]
208+
// [TestCase("net462", ExpectedResult = false)]
209+
// //[TestCase("net20", ExpectedResult = true)]
210+
//#endif
211+
// public bool LoadTargetFramework(string tfm)
212+
// {
213+
// return ExtensionManager.CanLoadTargetFramework(THIS_ASSEMBLY, FakeExtensions(tfm));
214+
// }
214215

215216
#endregion
216217

@@ -231,3 +232,4 @@ private static ExtensionAssembly FakeExtensions(string tfm)
231232
}
232233
}
233234
}
235+
#endif

0 commit comments

Comments
 (0)