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