diff --git a/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs b/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs index ecd770db8..5ebd6f0bf 100644 --- a/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs +++ b/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs @@ -47,25 +47,19 @@ internal ExtensionManager(IFileSystem fileSystem, IDirectoryFinder directoryFind #region IExtensionManager Implementation - /// - /// Gets an enumeration of all ExtensionPoints in the engine. - /// + /// public IEnumerable ExtensionPoints { get { return _extensionPoints.ToArray(); } } - /// - /// Gets an enumeration of all installed Extensions. - /// + /// public IEnumerable Extensions { get { return _extensions.ToArray(); } } - /// - /// Find the extension points in a loaded assembly. - /// + /// public virtual void FindExtensionPoints(params Assembly[] targetAssemblies) { foreach (var assembly in targetAssemblies) @@ -121,11 +115,7 @@ public virtual void FindExtensionPoints(params Assembly[] targetAssemblies) } } - /// - /// Find and install extensions starting from a given base directory, - /// and using the contained '.addins' files to direct the search. - /// - /// + /// public void FindExtensions(string startDir) { // Create the list of possible extension assemblies, @@ -137,11 +127,7 @@ public void FindExtensions(string startDir) FindExtensionsInAssembly(candidate); } - /// - /// Find and install standard extensions for a host assembly using - /// a built-in algorithm that searches in certain known locations. - /// - /// An assembly that supports extensions. + /// public void FindStandardExtensions(Assembly hostAssembly) { bool isChocolateyPackage = System.IO.File.Exists(Path.Combine(hostAssembly.Location, "VERIFICATION.txt")); @@ -155,14 +141,20 @@ public void FindStandardExtensions(Assembly hostAssembly) FindExtensionsInAssembly(candidate); } - /// - /// Get an ExtensionPoint based on its unique identifying path. - /// + /// public IExtensionPoint GetExtensionPoint(string path) { return _pathIndex.ContainsKey(path) ? _pathIndex[path] : null; } + /// + public IEnumerable GetExtensions() + { + foreach (var node in GetExtensionNodes()) + yield return (T)((ExtensionNode)node).ExtensionObject; // HACK + } + + /// public IEnumerable GetExtensionNodes(string path) { var ep = GetExtensionPoint(path); @@ -171,6 +163,7 @@ public IEnumerable GetExtensionNodes(string path) yield return node; } + /// public IExtensionNode GetExtensionNode(string path) { // TODO: Remove need for the cast @@ -179,6 +172,7 @@ public IExtensionNode GetExtensionNode(string path) return ep != null && ep.Extensions.Count > 0 ? ep.Extensions[0] : null; } + /// public IEnumerable GetExtensionNodes(bool includeDisabled = false) { var ep = GetExtensionPoint(typeof(T)); @@ -188,15 +182,7 @@ public IEnumerable GetExtensionNodes(bool includeDisabled = fa yield return node; } - public IEnumerable GetExtensions() - { - foreach (var node in GetExtensionNodes()) - yield return (T)((ExtensionNode)node).ExtensionObject; // HACK - } - - /// - /// Enable or disable an extension - /// + /// public void EnableExtension(string typeName, bool enabled) { foreach (var node in _extensions) diff --git a/src/NUnitEngine/nunit.engine.core/Services/IExtensionManager.cs b/src/NUnitEngine/nunit.engine.core/Services/IExtensionManager.cs index c6e9ebd63..e9c7858b3 100644 --- a/src/NUnitEngine/nunit.engine.core/Services/IExtensionManager.cs +++ b/src/NUnitEngine/nunit.engine.core/Services/IExtensionManager.cs @@ -10,9 +10,19 @@ namespace NUnit.Engine.Services { public interface IExtensionManager : IDisposable { + /// + /// Gets an enumeration of all ExtensionPoints in the engine. + /// IEnumerable ExtensionPoints { get; } + + /// + /// Gets an enumeration of all installed Extensions. + /// IEnumerable Extensions { get; } + /// + /// Find the extension points in a loaded assembly. + /// void FindExtensionPoints(params Assembly[] targetAssemblies); /// @@ -29,27 +39,37 @@ public interface IExtensionManager : IDisposable /// An assembly that supports NUnit extensions. void FindStandardExtensions(Assembly hostAssembly); + /// + /// Get an ExtensionPoint based on its unique identifying path. + /// IExtensionPoint GetExtensionPoint(string path); + /// + /// Get extension objects for all nodes of a given type + /// IEnumerable GetExtensions(); + /// + /// Get all ExtensionNodes for a give path + /// IEnumerable GetExtensionNodes(string path); + + /// + /// Get the first or only ExtensionNode for a given ExtensionPoint + /// + /// The identifying path for an ExtensionPoint + /// IExtensionNode GetExtensionNode(string path); + /// - /// Returns all extension nodes for a given Type. + /// Get all extension nodes of a given Type. /// - /// The Type of the node /// If true, disabled nodes are included - /// An enumeration of ExtensionNodes - /// - /// Unlike other methods, this method returns an actual ExtensionNode rather - /// than an IExtensionNode. It is required in order for classes that support - /// extensions to create the actual extension object. - /// - /// - // NOTE: IEnumerable GetExtensionNodes(bool includeDisabled = false); + /// + /// Enable or disable an extension + /// void EnableExtension(string typeName, bool enabled); }