Table of Contents

Class TraitAttribute

Namespace
Xunit
Assembly
xunit.v3.core.dll

Attribute used to decorate a test method, test class, or assembly with an arbitrary name/value pair ("trait").

[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
public sealed class TraitAttribute : Attribute, ITraitAttribute
Inheritance
TraitAttribute
Implements
Inherited Members

Constructors

TraitAttribute(string, string)

Attribute used to decorate a test method, test class, or assembly with an arbitrary name/value pair ("trait").

public TraitAttribute(string name, string value)

Parameters

name string

The trait name

value string

The trait value

Properties

Name

Get the trait name.

public string Name { get; }

Property Value

string

Value

Gets the trait value.

public string Value { get; }

Property Value

string

Methods

GetTraits()

Gets the trait values from the trait attribute.

public IReadOnlyCollection<KeyValuePair<string, string>> GetTraits()

Returns

IReadOnlyCollection<KeyValuePair<string, string>>

The trait values.