Merge pull request #1222 from LogosBible/uri-trycreate
[mono.git] / mcs / nunit24 / NUnitFramework / framework / IncludeExcludeAttributes.cs
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
6 \r
7 using System;\r
8 \r
9 namespace NUnit.Framework\r
10 {\r
11         /// <summary>\r
12         /// Abstract base for Attributes that are used to include tests\r
13         /// in the test run based on environmental settings.\r
14         /// </summary>\r
15         public abstract class IncludeExcludeAttribute : Attribute\r
16         {\r
17                 private string include;\r
18                 private string exclude;\r
19                 private string reason;\r
20 \r
21                 /// <summary>\r
22                 /// Constructor with no included items specified, for use\r
23                 /// with named property syntax.\r
24                 /// </summary>\r
25                 public IncludeExcludeAttribute() { }\r
26 \r
27                 /// <summary>\r
28                 /// Constructor taking one or more included items\r
29                 /// </summary>\r
30                 /// <param name="include">Comma-delimited list of included items</param>\r
31                 public IncludeExcludeAttribute( string include )\r
32                 {\r
33                         this.include = include;\r
34                 }\r
35 \r
36                 /// <summary>\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
40                 /// </summary>\r
41                 public string Include\r
42                 {\r
43                         get { return this.include; }\r
44                         set { include = value; }\r
45                 }\r
46 \r
47                 /// <summary>\r
48                 /// Name of the item to be excluded. Multiple items\r
49                 /// may be given, separated by a comma.\r
50                 /// </summary>\r
51                 public string Exclude\r
52                 {\r
53                         get { return this.exclude; }\r
54                         set { this.exclude = value; }\r
55                 }\r
56 \r
57                 /// <summary>\r
58                 /// The reason for including or excluding the test\r
59                 /// </summary>\r
60                 public string Reason\r
61                 {\r
62                         get { return reason; }\r
63                         set { reason = value; }\r
64                 }\r
65         }\r
66 \r
67         /// <summary>\r
68         /// PlatformAttribute is used to mark a test fixture or an\r
69         /// individual method as applying to a particular platform only.\r
70         /// </summary>\r
71         [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]\r
72         public class PlatformAttribute : IncludeExcludeAttribute\r
73         {\r
74                 /// <summary>\r
75                 /// Constructor with no platforms specified, for use\r
76                 /// with named property syntax.\r
77                 /// </summary>\r
78                 public PlatformAttribute() { }\r
79 \r
80                 /// <summary>\r
81                 /// Constructor taking one or more platforms\r
82                 /// </summary>\r
83                 /// <param name="platforms">Comma-deliminted list of platforms</param>\r
84                 public PlatformAttribute( string platforms ) : base( platforms ) { }\r
85         }\r
86 \r
87         /// <summary>\r
88         /// CultureAttribute is used to mark a test fixture or an\r
89         /// individual method as applying to a particular Culture only.\r
90         /// </summary>\r
91         [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]\r
92         public class CultureAttribute : IncludeExcludeAttribute\r
93         {\r
94                 /// <summary>\r
95                 /// Constructor with no cultures specified, for use\r
96                 /// with named property syntax.\r
97                 /// </summary>\r
98                 public CultureAttribute() { }\r
99 \r
100                 /// <summary>\r
101                 /// Constructor taking one or more cultures\r
102                 /// </summary>\r
103                 /// <param name="cultures">Comma-deliminted list of cultures</param>\r
104                 public CultureAttribute( string cultures ) : base( cultures ) { }\r
105         }\r
106 }\r