Table of Contents

Class TheoryAttribute

Namespace
Xunit
Assembly
xunit.v3.core.dll

Marks a test method as being a data theory. Data theories are tests which are fed various bits of 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).

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

Constructors

TheoryAttribute(string?, int)

Marks a test method as being a data theory. Data theories are tests which are fed various bits of 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).

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.