Table of Contents

Class StaFactAttribute

Namespace
Xunit
Assembly
Xunit.StaFact.dll

Identifies an xunit test that starts on an STA thread. Tests will be Skipped on non-Windows operating systems.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[XunitTestCaseDiscoverer(typeof(StaFactDiscoverer))]
public class StaFactAttribute : FactAttribute, _Attribute, IFactAttribute
Inheritance
FactAttribute
StaFactAttribute
Implements
IFactAttribute
Inherited Members
FactAttribute.DisplayName
FactAttribute.Explicit
FactAttribute.Skip
FactAttribute.SkipExceptions
FactAttribute.SkipType
FactAttribute.SkipUnless
FactAttribute.SkipWhen
FactAttribute.SourceFilePath
FactAttribute.SourceLineNumber
FactAttribute.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 UIFactAttribute.

Constructors

StaFactAttribute(string?, int)

Initializes a new instance of the StaFactAttribute class.

public StaFactAttribute(string? sourceFilePath = null, int sourceLineNumber = -1)

Parameters

sourceFilePath string
sourceLineNumber int