Table of Contents

Class DataAttribute

Namespace
Xunit.v3
Assembly
xunit.v3.core.aot.dll

Abstract attribute which is a base class for all other data attributes.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public abstract class DataAttribute : Attribute
Inheritance
DataAttribute
Derived
Inherited Members

Remarks

Unlike reflection-based data attributes, these must be discovered and data collected during code generation, so any supported attribute must be able to get its data without using reflection.

Properties

DisableParallelization

Gets a value which indicates whether tests yielded from this data source should be run in parallel against all other parallelizable tests.

Explicit

Sets a value that determines whether the data rows provided by this data provider should be considered explicit or not. If true, then the data rows will all be considered explicit; if false, then the data rows will all be considered not explicit; if null, then the data rows will inherit their explicitness from FactAttribute.Explicit.

ExplicitAsNullable

Sets a value that determines whether the data rows provided by this data provider should be considered explicit or not. If true, then the data rows will all be considered explicit; if false, then the data rows will all be considered not explicit; if unset, then the data rows will inherit their explicitness from FactAttribute.Explicit.

Label

Gets the label to use for the data row. This value is used to help format the display name of the test.

Skip

Gets a skip reason for all the data rows provided by this data provider. If not null, then all rows will be skipped with the given reason; if null, then the rows will inherit their skip reason from FactAttribute.Skip.

SkipType

Gets the type to retrieve SkipUnless or SkipWhen from. If not set, then the property will be retrieved from the unit test class.

SkipUnless

Gets the name of a public static property on the test class which returns bool to indicate whether the test should be skipped (false) or not (true).

SkipWhen

Gets the name of a public static property on the test class which returns bool to indicate whether the test should be skipped (true) or not (false).

TestDisplayName

Gets the test display name for the test (replacing the default behavior, which would be to use FactAttribute.DisplayName, or falling back to generating display names based on TestMethodDisplay and TestMethodDisplayOptions).

Timeout

Sets a value to determine if the data rows provided by this data provider should include a timeout (in milliseconds). If greater than zero, the data rows will have the given timeout; if zero or less, the data rows will not have a timeout; if null, the data rows will inherit their timeout from FactAttribute.Timeout.

TimeoutAsNullable

Gets or sets a value to determine if the data rows provided by this data provider should include a timeout (in milliseconds). If greater than zero, the data rows will have the given timeout; if zero or less, the data rows will not have a timeout; if unset, the data rows will inherit their timeout from FactAttribute.Timeout.

Traits

Gets a set of traits for the associated data. The data is provided as an array of string values that are alternating keys and values (e.g., ["key1", "value1", "key2", "value2"]).