Table of Contents

Class TheoryAttribute

Namespace
Xunit
Assembly
xunit.v3.core.dll

Attribute that is applied to a method to indicate that it is a data theory that should be run by the default test runner.

[XunitTestCaseDiscoverer(typeof(TheoryDiscoverer))]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TheoryAttribute : FactAttribute, ITheoryAttribute, IFactAttribute
Inheritance
TheoryAttribute
Implements
Derived
Inherited Members

Remarks

Data theories are tests which are fed data from a data source, mapping to parameters on the test method. If the data source contains multiple rows, then the test method is executed multiple times (once with each data row). Data is provided by attributes which implement IDataAttribute (most commonly, InlineDataAttribute and MemberDataAttribute).

Constructors

TheoryAttribute(string?, int)

Attribute that is applied to a method to indicate that it is a data theory that should be run by the default test runner.

Properties

DisableDiscoveryEnumeration

Gets a flag which indicates whether the test method wants to skip enumerating data during discovery. This will cause the theory to yield a single test case for all data, and the data discovery will be performed during test execution instead of discovery.

SkipTestWithoutData

Gets a flag which indicates whether the test should be skipped (rather than failed) for a lack of data.