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/?p=license&r=2.4 5 // **************************************************************** 6 7 using System; 8 9 namespace NUnit.Framework 10 { 11 /// <summary> 12 /// ExplicitAttribute marks a test or test fixture so that it will 13 /// only be run if explicitly executed from the gui or command line 14 /// or if it is included by use of a filter. The test will not be 15 /// run simply because an enclosing suite is run. 16 /// </summary> 17 [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)] 18 public class ExplicitAttribute : Attribute 19 { 20 private string reason; 21 22 /// <summary> 23 /// Default constructor 24 /// </summary> ExplicitAttribute()25 public ExplicitAttribute() 26 { 27 this.reason = ""; 28 } 29 30 /// <summary> 31 /// Constructor with a reason 32 /// </summary> 33 /// <param name="reason">The reason test is marked explicit</param> ExplicitAttribute(string reason)34 public ExplicitAttribute(string reason) 35 { 36 this.reason = reason; 37 } 38 39 /// <summary> 40 /// The reason test is marked explicit 41 /// </summary> 42 public string Reason 43 { 44 get { return reason; } 45 } 46 } 47 } 48