PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/core/ExtensionHost.cs

#
C# | 54 lines | 34 code | 8 blank | 12 comment | 2 complexity | 46307f71b2eb3394c8232f66971ba029 MD5 | raw file
Possible License(s): GPL-2.0
  1. // ****************************************************************
  2. // Copyright 2007, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org.
  5. // ****************************************************************
  6. using System;
  7. using System.Collections;
  8. using NUnit.Core.Extensibility;
  9. namespace NUnit.Core
  10. {
  11. /// <summary>
  12. /// ExtensionHost is the abstract base class used for
  13. /// all extension hosts. It provides an array of
  14. /// extension points and a FrameworkRegistry and
  15. /// implements the IExtensionHost interface. Derived
  16. /// classes must initialize the extension points.
  17. /// </summary>
  18. public abstract class ExtensionHost : IExtensionHost
  19. {
  20. #region Protected Fields
  21. protected ArrayList extensions;
  22. protected ExtensionType supportedTypes;
  23. #endregion
  24. #region IExtensionHost Interface
  25. public IExtensionPoint[] ExtensionPoints
  26. {
  27. get { return (IExtensionPoint[])extensions.ToArray(typeof(IExtensionPoint)); }
  28. }
  29. public IFrameworkRegistry FrameworkRegistry
  30. {
  31. get { return (IFrameworkRegistry)GetExtensionPoint("FrameworkRegistry"); }
  32. }
  33. public IExtensionPoint GetExtensionPoint( string name )
  34. {
  35. foreach ( IExtensionPoint extensionPoint in extensions )
  36. if ( extensionPoint.Name == name )
  37. return extensionPoint;
  38. return null;
  39. }
  40. public ExtensionType ExtensionTypes
  41. {
  42. get { return supportedTypes; }
  43. }
  44. #endregion
  45. }
  46. }