1 // ****************************************************************
\r
2 // This is free software licensed under the NUnit license. You
\r
3 // may obtain a copy of the license as well as information regarding
\r
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.
\r
5 // ****************************************************************
\r
9 namespace NUnit.Framework
\r
12 /// Attribute used to apply a category to a test
\r
14 [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
\r
15 public class CategoryAttribute : Attribute
\r
18 /// The name of the category
\r
20 protected string categoryName;
\r
23 /// Construct attribute for a given category
\r
25 /// <param name="name">The name of the category</param>
\r
26 public CategoryAttribute(string name)
\r
28 this.categoryName = name;
\r
32 /// Protected constructor uses the Type name as the name
\r
33 /// of the category.
\r
35 protected CategoryAttribute()
\r
37 this.categoryName = this.GetType().Name;
\r
38 if ( categoryName.EndsWith( "Attribute" ) )
\r
39 categoryName = categoryName.Substring( 0, categoryName.Length - 9 );
\r
43 /// The name of the category
\r
47 get { return categoryName; }
\r