1 // ****************************************************************
\r
2 // Copyright 2007, Charlie Poole
\r
3 // This is free software licensed under the NUnit license. You may
\r
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
\r
5 // ****************************************************************
\r
9 namespace NUnit.Framework
\r
12 /// Abstract base for Attributes that are used to include tests
\r
13 /// in the test run based on environmental settings.
\r
15 public abstract class IncludeExcludeAttribute : Attribute
\r
17 private string include;
\r
18 private string exclude;
\r
19 private string reason;
\r
22 /// Constructor with no included items specified, for use
\r
23 /// with named property syntax.
\r
25 public IncludeExcludeAttribute() { }
\r
28 /// Constructor taking one or more included items
\r
30 /// <param name="include">Comma-delimited list of included items</param>
\r
31 public IncludeExcludeAttribute( string include )
\r
33 this.include = include;
\r
37 /// Name of the item that is needed in order for
\r
38 /// a test to run. Multiple itemss may be given,
\r
39 /// separated by a comma.
\r
41 public string Include
\r
43 get { return this.include; }
\r
44 set { include = value; }
\r
48 /// Name of the item to be excluded. Multiple items
\r
49 /// may be given, separated by a comma.
\r
51 public string Exclude
\r
53 get { return this.exclude; }
\r
54 set { this.exclude = value; }
\r
58 /// The reason for including or excluding the test
\r
60 public string Reason
\r
62 get { return reason; }
\r
63 set { reason = value; }
\r
68 /// PlatformAttribute is used to mark a test fixture or an
\r
69 /// individual method as applying to a particular platform only.
\r
71 [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
\r
72 public class PlatformAttribute : IncludeExcludeAttribute
\r
75 /// Constructor with no platforms specified, for use
\r
76 /// with named property syntax.
\r
78 public PlatformAttribute() { }
\r
81 /// Constructor taking one or more platforms
\r
83 /// <param name="platforms">Comma-deliminted list of platforms</param>
\r
84 public PlatformAttribute( string platforms ) : base( platforms ) { }
\r
88 /// CultureAttribute is used to mark a test fixture or an
\r
89 /// individual method as applying to a particular Culture only.
\r
91 [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]
\r
92 public class CultureAttribute : IncludeExcludeAttribute
\r
95 /// Constructor with no cultures specified, for use
\r
96 /// with named property syntax.
\r
98 public CultureAttribute() { }
\r
101 /// Constructor taking one or more cultures
\r
103 /// <param name="cultures">Comma-deliminted list of cultures</param>
\r
104 public CultureAttribute( string cultures ) : base( cultures ) { }
\r