Class CategoryAttribute
Applies a category to a test
Implements
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class CategoryAttribute : NUnitAttribute, IApplyToTest
Constructors
View SourceCategoryAttribute()
Protected constructor uses the Type name as the name of the category.
Declaration
protected CategoryAttribute()
CategoryAttribute(string)
Construct attribute for a given category based on a name. The name may not contain the characters ',', '+', '-' or '!'. However, this is not checked in the constructor since it would cause an error to arise at as the test was loaded without giving a clear indication of where the problem is located. The error is handled in NUnitFramework.cs by marking the test as not runnable.
Declaration
public CategoryAttribute(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the category |
Fields
View SourcecategoryName
The name of the category
Declaration
protected string categoryName
Field Value
Type | Description |
---|---|
string |
Properties
View SourceName
The name of the category
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceApplyToTest(Test)
Modifies a test by adding a category to it.
Declaration
public void ApplyToTest(Test test)
Parameters
Type | Name | Description |
---|---|---|
Test | test | The test to modify |