1111
1212namespace TestCentric . Extensibility
1313{
14- [ TestFixture ( null ) ]
15- [ TestFixture ( "/TestCentric/Engine/TypeExtensions/" ) ]
1614 public class ExtensionManagerTests
1715 {
1816 protected static readonly Assembly THIS_ASSEMBLY = typeof ( ExtensionManagerTests ) . Assembly ;
1917 protected static readonly string THIS_ASSEMBLY_DIRECTORY = Path . GetDirectoryName ( THIS_ASSEMBLY . Location ) ;
2018
21- protected static readonly Assembly TESTCENTRIC_ENGINE_API = typeof ( TestCentric . Engine . Extensibility . IDriverFactory ) . Assembly ;
22- protected static readonly Assembly NUNIT_ENGINE_API = typeof ( NUnit . Engine . Extensibility . IDriverFactory ) . Assembly ;
23-
24- protected string DefaultTypeExtensionsPath ;
2519 protected ExtensionManager ExtensionManager ;
2620
27- public ExtensionManagerTests ( string defaultTypeExtensionsPath )
21+ public ExtensionManagerTests ( )
2822 {
29- DefaultTypeExtensionsPath = defaultTypeExtensionsPath ;
30-
31- var prefix = defaultTypeExtensionsPath ?? "/TestCentric/TypeExtensions/" ;
32-
3323 ExpectedExtensionPointPaths = new [ ]
3424 {
35- prefix + "IAgentLauncher" ,
36- "/NUnit/Engine/TypeExtensions/ITestEventListener" ,
37- "/NUnit/Engine/TypeExtensions/IService" ,
38- "/NUnit/Engine/TypeExtensions/IDriverFactory" ,
39- "/NUnit/Engine/TypeExtensions/IResultWriter" ,
40- "/NUnit/Engine/TypeExtensions/IProjectLoader" ,
41- #if ! NET35
42- "/NUnit/Engine/TypeExtensions/IAgentLauncher"
43- #endif
25+ "/TestCentric/Engine/AgentLaunchers" ,
26+ "/TestCentric/Engine/TestEventListeners" ,
27+ "/TestCentric/Engine/DriverFactories" ,
28+ "/TestCentric/Engine/ResultWriters" ,
29+ "/TestCentric/Engine/ProjectLoaders"
4430 } ;
4531
4632 // This could be initialized inline, but it's here for clarity
4733 ExpectedExtensionPointTypes = new [ ]
4834 {
4935 typeof ( TestCentric . Engine . Extensibility . IAgentLauncher ) ,
5036 typeof ( NUnit . Engine . ITestEventListener ) ,
51- typeof ( NUnit . Engine . IService ) ,
5237 typeof ( NUnit . Engine . Extensibility . IDriverFactory ) ,
5338 typeof ( NUnit . Engine . Extensibility . IResultWriter ) ,
5439 typeof ( NUnit . Engine . Extensibility . IProjectLoader ) ,
55- #if ! NET35
56- typeof ( NUnit . Engine . Extensibility . IAgentLauncher )
57- #endif
5840 } ;
5941 }
6042
@@ -66,22 +48,16 @@ public ExtensionManagerTests(string defaultTypeExtensionsPath)
6648 public void CreateManager ( )
6749 {
6850 ExtensionManager = new ExtensionManager ( ) ;
69- if ( DefaultTypeExtensionsPath != null )
70- ExtensionManager . TypeExtensionPath = DefaultTypeExtensionsPath ;
7151
72- // Initialize ExtensionManager using extension points in TestCentric API assembly
73- // with fake extensions defined in this assembly.
52+ // Initialize ExtensionManager using extension points defined in this
53+ // assembly and extensions defined in the fake extensions assembly.
7454
75- ExtensionManager . FindExtensionPoints ( TESTCENTRIC_ENGINE_API , NUNIT_ENGINE_API ) ;
55+ ExtensionManager . FindExtensionPoints ( THIS_ASSEMBLY ) ;
7656 Assert . That ( ExtensionManager . ExtensionPoints . Count , Is . GreaterThan ( 0 ) , "No ExtensionPoints were found" ) ;
77- foreach ( var extensionPoint in ExtensionManager . ExtensionPoints )
78- Console . WriteLine ( $ "Found ExtensionPoint: { extensionPoint . TypeName } Path={ extensionPoint . Path } ") ;
7957
8058 ExtensionManager . FindExtensionAssemblies ( FAKE_EXTENSIONS_PARENT_DIRECTORY ) ;
8159 ExtensionManager . CompleteExtensionDiscovery ( ) ;
8260 Assert . That ( ExtensionManager . Extensions . Count , Is . GreaterThan ( 0 ) , "No Extensions were found" ) ;
83- foreach ( var extension in ExtensionManager . Extensions )
84- Console . WriteLine ( $ "Found Extension: { extension . TypeName } Path={ extension . Path } ") ;
8561 }
8662
8763 #region Extension Point Tests
@@ -143,12 +119,10 @@ internal class ThisIsNotAnExtensionPoint
143119 [
144120 "TestCentric.Engine.Extensibility.FakeAgentLauncher" ,
145121 "TestCentric.Engine.Extensibility.FakeAgentLauncher_ThrowsInConstructor" ,
146- #if ! NET35
147- "NUnit.Engine.Extensibility.FakeTestEventListener" ,
148- "NUnit.Engine.Extensibility.FakeProjectLoader" ,
149- "NUnit.Engine.Extensibility.FakeResultWriter" ,
150- "NUnit.Engine.Extensibility.FakeNUnitExtension_ThrowsInConstructor"
151- #endif
122+ "TestCentric.Engine.Extensibility.FakeTestEventListener" ,
123+ "TestCentric.Engine.Extensibility.FakeProjectLoader" ,
124+ "TestCentric.Engine.Extensibility.FakeResultWriter" ,
125+ "TestCentric.Engine.Extensibility.FakeNUnitExtension_ThrowsInConstructor"
152126 ] ;
153127
154128 [ Test ]
@@ -157,30 +131,29 @@ public void AllExtensionsAreKnown()
157131 Assert . That ( ExtensionManager . Extensions . Select ( ep => ep . TypeName ) , Is . EquivalentTo ( KnownExtensionTypeNames ) ) ;
158132 }
159133
160- #if ! NET35
161134 // Run this first as subsequent test will enable the extension
162135 [ Test , Order ( 1 ) ]
163136 public void ExtensionMayBeDisabledByDefault ( )
164137 {
165138 Assert . That ( ExtensionManager . Extensions ,
166- Has . One . Property ( nameof ( ExtensionNode . TypeName ) ) . EqualTo ( "NUnit .Engine.Extensibility.FakeTestEventListener" )
139+ Has . One . Property ( nameof ( ExtensionNode . TypeName ) ) . EqualTo ( "TestCentric .Engine.Extensibility.FakeTestEventListener" )
167140 . And . Property ( nameof ( ExtensionNode . Enabled ) ) . False ) ;
168141 }
169142
170143 [ Test ]
171144 public void DisabledExtensionMayBeEnabled ( )
172145 {
173- ExtensionManager . EnableExtension ( "NUnit .Engine.Extensibility.FakeTestEventListener" , true ) ;
146+ ExtensionManager . EnableExtension ( "TestCentric .Engine.Extensibility.FakeTestEventListener" , true ) ;
174147
175148 Assert . That ( ExtensionManager . Extensions ,
176- Has . One . Property ( nameof ( ExtensionNode . TypeName ) ) . EqualTo ( "NUnit .Engine.Extensibility.FakeTestEventListener" )
149+ Has . One . Property ( nameof ( ExtensionNode . TypeName ) ) . EqualTo ( "TestCentric .Engine.Extensibility.FakeTestEventListener" )
177150 . And . Property ( nameof ( ExtensionNode . Enabled ) ) . True ) ;
178151 }
179152
180153 [ Test ]
181154 public void NUnitExtensionThrowsInConstructor ( )
182155 {
183- string typeName = "NUnit .Engine.Extensibility.FakeNUnitExtension_ThrowsInConstructor" ;
156+ string typeName = "TestCentric .Engine.Extensibility.FakeNUnitExtension_ThrowsInConstructor" ;
184157 var exNode = ExtensionManager . Extensions . Where ( n => n . TypeName == typeName ) . Single ( ) ;
185158
186159 // Although the constructor throws, we don't get an exception.
@@ -190,7 +163,6 @@ public void NUnitExtensionThrowsInConstructor()
190163 Assert . That ( exNode . Exception , Is . InstanceOf < ExtensibilityException > ( ) ) ;
191164 Assert . That ( exNode . Exception . InnerException , Is . InstanceOf < NotImplementedException > ( ) ) ;
192165 }
193- #endif
194166
195167 [ Test ]
196168 public void TestCentricExtensionThrowsInConstructor ( )
@@ -209,15 +181,15 @@ public void TestCentricExtensionThrowsInConstructor()
209181#if NETCOREAPP
210182 [ TestCase ( "netstandard2.0" , ExpectedResult = true ) ]
211183 [ TestCase ( "net462" , ExpectedResult = false ) ]
212- // [TestCase("net20", ExpectedResult = false)]
184+ [ TestCase ( "net20" , ExpectedResult = false ) ]
213185#elif NET40_OR_GREATER
214186 [ TestCase ( "netstandard2.0" , ExpectedResult = false ) ]
215187 [ TestCase ( "net462" , ExpectedResult = true ) ]
216- // [TestCase("net20", ExpectedResult = true)]
188+ [ TestCase ( "net20" , ExpectedResult = true ) ]
217189#else
218190 [ TestCase ( "netstandard2.0" , ExpectedResult = false ) ]
219191 [ TestCase ( "net462" , ExpectedResult = false ) ]
220- // [TestCase("net20", ExpectedResult = true)]
192+ [ TestCase ( "net20" , ExpectedResult = true ) ]
221193#endif
222194 public bool LoadTargetFramework ( string tfm )
223195 {
0 commit comments