PageRenderTime 72ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/core/Extensibility/TestDecoratorCollection.cs

#
C# | 44 lines | 28 code | 6 blank | 10 comment | 0 complexity | b66f35c5aecf27d7df8fddb3f58c69ca 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 System.Reflection;
  9. namespace NUnit.Core.Extensibility
  10. {
  11. /// <summary>
  12. /// TestDecoratorCollection is an ExtensionPoint for TestDecorators and
  13. /// implements the ITestDecorator interface itself, passing calls
  14. /// on to the individual decorators.
  15. /// </summary>
  16. public class TestDecoratorCollection : ExtensionPoint, IExtensionPoint2, ITestDecorator
  17. {
  18. #region Constructor
  19. public TestDecoratorCollection(IExtensionHost host)
  20. : base( "TestDecorators", host, 10 ) { }
  21. #endregion
  22. #region ITestDecorator Members
  23. public Test Decorate(Test test, MemberInfo member)
  24. {
  25. Test decoratedTest = test;
  26. foreach( ITestDecorator decorator in Extensions )
  27. decoratedTest = decorator.Decorate( decoratedTest, member );
  28. return decoratedTest;
  29. }
  30. #endregion
  31. #region ExtensionPoint Overrides
  32. protected override bool IsValidExtension(object extension)
  33. {
  34. return extension is ITestDecorator;
  35. }
  36. #endregion
  37. }
  38. }