/src/NUnit/framework/Attributes/IgnoreAttribute.cs

# · C# · 47 lines · 21 code · 5 blank · 21 comment · 0 complexity · f07891e7e86ad158df4e224ae4ad9b37 MD5 · raw file

  1. // ****************************************************************
  2. // This is free software licensed under the NUnit license. You
  3. // may obtain a copy of the license as well as information regarding
  4. // copyright ownership at http://nunit.org.
  5. // ****************************************************************
  6. namespace NUnit.Framework
  7. {
  8. using System;
  9. /// <summary>
  10. /// Attribute used to mark a test that is to be ignored.
  11. /// Ignored tests result in a warning message when the
  12. /// tests are run.
  13. /// </summary>
  14. [AttributeUsage(AttributeTargets.Method|AttributeTargets.Class|AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
  15. public class IgnoreAttribute : Attribute
  16. {
  17. private string reason;
  18. /// <summary>
  19. /// Constructs the attribute without giving a reason
  20. /// for ignoring the test.
  21. /// </summary>
  22. public IgnoreAttribute()
  23. {
  24. this.reason = "";
  25. }
  26. /// <summary>
  27. /// Constructs the attribute giving a reason for ignoring the test
  28. /// </summary>
  29. /// <param name="reason">The reason for ignoring the test</param>
  30. public IgnoreAttribute(string reason)
  31. {
  32. this.reason = reason;
  33. }
  34. /// <summary>
  35. /// The reason for ignoring a test
  36. /// </summary>
  37. public string Reason
  38. {
  39. get { return reason; }
  40. }
  41. }
  42. }