DataParamAttribute Class

Summary

Base class for attributes, which provide test arguments directly in the attribute constructor. Since .NET severely restricts the data Types, which may be used in this context, the attribute tries to simulate what that might have been provided in a direct method call.

For example, since you can’t apply attributes using decimal arguments, we allow an int or a double value to be specified and then convert it to decimal.

This class is unsealed and may be inherited by custom user attributes that take test arguments directly.

graph BT Type-->Base0["TCLiteAttribute"] click Base0 "/tc-lite/api/TCLite/TCLiteAttribute" Base0-->Base1["Attribute"] Base1-->Base2["object"] Type["DataParamAttribute"] class Type type-node Derived0["ValueSourceAttribute"]-->Type click Derived0 "/tc-lite/api/TCLite/ValueSourceAttribute" Derived1["TestCaseAttribute"]-->Type click Derived1 "/tc-lite/api/TCLite/TestCaseAttribute" Derived2["RangeAttribute"]-->Type click Derived2 "/tc-lite/api/TCLite/RangeAttribute" Derived3["RandomAttribute"]-->Type click Derived3 "/tc-lite/api/TCLite/RandomAttribute" Derived4["ValuesAttribute"]-->Type click Derived4 "/tc-lite/api/TCLite/ValuesAttribute"

Syntax

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]
public class DataParamAttribute : TCLiteAttribute

Attributes

Type Description
AttributeUsageAttribute

Methods

Name Value Summary
Convert(object, Type) object
Converts a single value to the targetType, if it is supported.
static
ConvertData(object[], Type) IEnumerable
Converts an array of objects to the targetType, if it is supported.
static
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.
static