@@ -14,7 +14,9 @@ namespace NUnit.Engine.Services
1414 /// </summary>
1515 public class ExtensionService : Service , IExtensionService
1616 {
17- private readonly ExtensionManager _extensionManager ;
17+ // The Extension Manager is available internally to allow direct
18+ // access to ExtensionPoints and ExtensionNodes.
19+ internal readonly ExtensionManager _extensionManager ;
1820
1921 public ExtensionService ( )
2022 {
@@ -32,9 +34,19 @@ internal ExtensionService(IFileSystem fileSystem, IDirectoryFinder directoryFind
3234 _extensionManager = new ExtensionManager ( fileSystem , directoryFinder ) ;
3335 }
3436
35- public IEnumerable < IExtensionPoint > ExtensionPoints => _extensionManager . ExtensionPoints ;
37+ #region IExtensionService Implementation
3638
37- public IEnumerable < IExtensionNode > Extensions => _extensionManager . Extensions ;
39+ /// <summary>
40+ /// Gets an enumeration of all extension points in the engine.
41+ /// </summary>
42+ /// <returns>An enumeration of IExtensionPoints. </returns>
43+ IEnumerable < IExtensionPoint > IExtensionService . ExtensionPoints => this . ExtensionPoints ;
44+
45+ /// <summary>
46+ /// Gets an enumeration of all installed Extensions.
47+ /// </summary>
48+ /// <returns>An enumeration of IExtensionNodes</returns>
49+ IEnumerable < IExtensionNode > IExtensionService . Extensions => this . Extensions ;
3850
3951 /// <summary>
4052 /// Find candidate extension assemblies starting from a given base directory,
@@ -57,23 +69,82 @@ public void FindExtensionAssemblies(string initialDirectory)
5769 /// <summary>
5870 /// Get an enumeration of ExtensionNodes based on their identifying path.
5971 /// </summary>
60- IEnumerable < IExtensionNode > IExtensionService . GetExtensionNodes ( string path )
61- {
62- foreach ( var node in _extensionManager . GetExtensionNodes ( path ) )
63- yield return node ;
64- }
72+ IEnumerable < IExtensionNode > IExtensionService . GetExtensionNodes ( string path ) => this . GetExtensionNodes ( path ) ;
6573
74+ /// <summary>
75+ /// Enable or disable an extension
76+ /// </summary>
6677 public void EnableExtension ( string typeName , bool enabled )
6778 {
6879 _extensionManager . EnableExtension ( typeName , enabled ) ;
6980 }
7081
82+ /// <summary>
83+ /// If extensions have not yet been loaded, examine all candidate assemblies
84+ /// and load them. Subsequent calls are ignored.
85+ /// </summary>
86+ public void LoadExtensions ( ) => _extensionManager . LoadExtensions ( ) ;
87+
88+ /// <summary>
89+ /// Get extension objects for all nodes of a given type
90+ /// </summary>
91+ /// <returns>An enumeration of T</returns>
7192 public IEnumerable < T > GetExtensions < T > ( ) => _extensionManager . GetExtensions < T > ( ) ;
7293
73- public IExtensionNode ? GetExtensionNode ( string path ) => _extensionManager . GetExtensionNode ( path ) ;
94+ /// <summary>
95+ /// Get all extension nodes of a given Type.
96+ /// </summary>
97+ /// An enumeration of IExtensionNodes for Type T.
98+ IEnumerable < IExtensionNode > IExtensionService . GetExtensionNodes < T > ( ) => this . GetExtensionNodes < T > ( ) ;
99+
100+ #endregion
101+
102+ #region Class Properties and Methods
103+
104+ /// <summary>
105+ /// Gets an enumeration of all extension points in the engine.
106+ /// </summary>
107+ /// <returns>An enumeration of ExtensionPoints. </returns>
108+ /// <remarks>This class property returns actual ExtensionPoints rather than the IExtensionPoint interface.</remarks>
109+ public IEnumerable < ExtensionPoint > ExtensionPoints => _extensionManager . ExtensionPoints ;
110+
111+ /// <summary>
112+ /// Gets an enumeration of all installed Extensions.
113+ /// </summary>
114+ /// <returns>An enumeration of ExtensionNodes</returns>
115+ /// <remarks>This class property returns actual ExtensionNodes rather than the IExtensionNode interface.</remarks>
116+ public IEnumerable < ExtensionNode > Extensions => _extensionManager . Extensions ;
117+
118+ /// <summary>
119+ /// Get an ExtensionPoint based on its unique identifying path.
120+ /// </summary>
121+ /// <remarks>This class method returns an actual ExtensionPoint rather than the IExtensionPoint interface.</remarks>
122+ public ExtensionPoint ? GetExtensionPoint ( string path )
123+ {
124+ return _extensionManager . GetExtensionPoint ( path ) ;
125+ }
74126
127+ /// <summary>
128+ /// Get an enumeration of ExtensionNodes based on their identifying path.
129+ /// </summary>
130+ /// <remarks>This class method returns actual ExtensionNodes rather than the IExtensionNode interface.</remarks>
131+ public IEnumerable < ExtensionNode > GetExtensionNodes ( string path )
132+ {
133+ foreach ( var node in _extensionManager . GetExtensionNodes ( path ) )
134+ yield return node ;
135+ }
136+
137+ /// <summary>
138+ /// Get all extension nodes of a given Type.
139+ /// </summary>
140+ /// <returns>An enumeration of ExtensionNodes for Type T.</returns>
141+ /// <remarks>This class method returns actual ExtensionNodes rather than the IExtensionNode interface.</remarks>
75142 public IEnumerable < ExtensionNode > GetExtensionNodes < T > ( ) => _extensionManager . GetExtensionNodes < T > ( ) ;
76143
144+ #endregion
145+
146+ #region IService Implementation
147+
77148 public override void StartService ( )
78149 {
79150 try
@@ -100,5 +171,7 @@ public override void StopService()
100171
101172 Status = ServiceStatus . Stopped ;
102173 }
174+
175+ #endregion
103176 }
104177}
0 commit comments