TestCaseAttribute Class

Summary

TestCaseAttribute is used to mark both parameterized and non-parameterized test cases. In the case of parameterized tests, it provides the arguments to be used.
graph BT Type-->Base0["DataParamAttribute"] click Base0 "/tc-lite/api/TCLite/DataParamAttribute" Base0-->Base1["TCLiteAttribute"] click Base1 "/tc-lite/api/TCLite/TCLiteAttribute" Base1-->Base2["Attribute"] Base2-->Base3["object"] Type-.->Interface0["ITestCaseData"] click Interface0 "/tc-lite/api/TCLite.Interfaces/ITestCaseData" Type-.->Interface1["ITestData"] click Interface1 "/tc-lite/api/TCLite.Interfaces/ITestData" Type-.->Interface2["ITestCaseFactory"] click Interface2 "/tc-lite/api/TCLite.Interfaces/ITestCaseFactory" Type-.->Interface3["IImplyFixture"] click Interface3 "/tc-lite/api/TCLite.Interfaces/IImplyFixture" Type["TestCaseAttribute"] class Type type-node

Syntax

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class TestCaseAttribute : DataParamAttribute, ITestCaseData, ITestData, ITestCaseFactory, 
    IImplyFixture

Attributes

Type Description
AttributeUsageAttribute

Constructors

Name Summary
TestCaseAttribute(object[]) Construct a TestCaseAttribute with a list of arguments. This constructor is not CLS-Compliant

Properties

Name Value Summary
Arguments object[]
Gets the list of arguments to a test case
Categories IList
Gets a list of categories for this fixture
Category string
Gets and sets the category for this fixture. May be a comma-separated list of categories.
Description string
Gets or sets the description.
ExpectedResult object
Gets or sets the expected result.
HasExpectedResult bool
Returns true if the expected result has been set
Ignore bool
Gets or sets the ignored status of the test
IgnoreReason string
Gets or sets the ignore reason. When set to a non-null non-empty value, the test is marked as ignored.
Properties IPropertyBag
Gets the properties of the test case
Reason string
Gets or sets the reason for not running the test.
RunState RunState
Gets the RunState of this test case.
TestName string
Gets the name of the test.

Methods

Name Value Summary
Convert(object, Type) object
Converts a single value to the targetType, if it is supported.
Inherited from DataParamAttribute
static
ConvertData(object[], Type) IEnumerable
Converts an array of objects to the targetType, if it is supported.
Inherited from DataParamAttribute
static
GetTestCasesFor(MethodInfo) IEnumerable<ITestCaseData>
Returns an collection containing a single ITestCaseData item, constructed from the arguments provided in the constructor and possibly converted to match the specified method.
TryConvert(object, Type, object) bool
Performs several special conversions allowed by NUnit in order to permit arguments with types that cannot be used in the constructor of an Attribute such as TestCaseAttribute or to simplify their use.
Inherited from DataParamAttribute
static