2 using System.Collections;
\r
3 using NUnit.Core.Extensibility;
\r
8 /// ExtensionPoint is used as a base class for all
\r
9 /// extension points.
\r
11 public abstract class ExtensionPoint : IExtensionPoint
\r
13 private string name;
\r
14 private IExtensionHost host;
\r
16 protected ArrayList extensions = new ArrayList();
\r
19 public ExtensionPoint(string name, IExtensionHost host)
\r
26 #region IExtensionPoint Members
\r
28 /// Get the name of this extension point
\r
32 get { return this.name; }
\r
36 /// Get the host that provides this extension point
\r
38 public IExtensionHost Host
\r
40 get { return this.host; }
\r
44 /// Install an extension at this extension point. If the
\r
45 /// extension object does not meet the requirements for
\r
46 /// this extension point, an exception is thrown.
\r
48 /// <param name="extension">The extension to install</param>
\r
49 public void Install(object extension)
\r
51 if ( !ValidExtension( extension ) )
\r
52 throw new ArgumentException(
\r
53 extension.GetType().FullName + " is not {0} extension point", "extension" );
\r
55 extensions.Add( extension );
\r
59 /// Removes an extension from this extension point. If the
\r
60 /// extension object is not present, the method returns
\r
63 /// <param name="extension"></param>
\r
64 public void Remove(object extension)
\r
66 extensions.Remove( extension );
\r
70 #region Abstract Methods
\r
71 protected abstract bool ValidExtension(object extension);
\r