// **************************************************************** // This is free software licensed under the NUnit license. You // may obtain a copy of the license as well as information regarding // copyright ownership at http://nunit.org/?p=license&r=2.4. // **************************************************************** using System; namespace NUnit.Framework { /// /// Attribute used to apply a category to a test /// [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)] public class CategoryAttribute : Attribute { /// /// The name of the category /// protected string categoryName; /// /// Construct attribute for a given category /// /// The name of the category public CategoryAttribute(string name) { this.categoryName = name; } /// /// Protected constructor uses the Type name as the name /// of the category. /// protected CategoryAttribute() { this.categoryName = this.GetType().Name; if ( categoryName.EndsWith( "Attribute" ) ) categoryName = categoryName.Substring( 0, categoryName.Length - 9 ); } /// /// The name of the category /// public string Name { get { return categoryName; } } } }