Class StaTheoryAttribute
- Namespace
- Xunit
- Assembly
- Xunit.StaFact.dll
Identifies an xunit theory that starts on an STA thread. Tests will be Skipped on non-Windows operating systems.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[XunitTestCaseDiscoverer(typeof(StaTheoryDiscoverer))]
public class StaTheoryAttribute : TheoryAttribute, _Attribute, ITheoryAttribute, IFactAttribute
- Inheritance
-
FactAttributeTheoryAttributeStaTheoryAttribute
- Implements
-
ITheoryAttributeIFactAttribute
- Inherited Members
-
TheoryAttribute.DisableDiscoveryEnumerationTheoryAttribute.SkipTestWithoutDataFactAttribute.DisplayNameFactAttribute.ExplicitFactAttribute.SkipFactAttribute.SkipExceptionsFactAttribute.SkipTypeFactAttribute.SkipUnlessFactAttribute.SkipWhenFactAttribute.SourceFilePathFactAttribute.SourceLineNumberFactAttribute.Timeout
Remarks
The test does not apply a SynchronizationContext, so an async test will resume on a standard MTA thread from the thread pool. To get an STA thread even after awaiting expressions, use UITheoryAttribute.
Constructors
StaTheoryAttribute(string?, int)
Initializes a new instance of the StaTheoryAttribute class.
public StaTheoryAttribute(string? sourceFilePath = null, int sourceLineNumber = -1)