Class XunitTestRunnerBaseContext<TTest>
Context class for XunitTestRunner.
public class XunitTestRunnerBaseContext<TTest> : TestRunnerContext<TTest>, IAsyncLifetime, IAsyncDisposable where TTest : class, IXunitTest
Type Parameters
TTest
- Inheritance
-
TestRunnerBaseContext<TTest>TestRunnerContext<TTest>XunitTestRunnerBaseContext<TTest>
- Implements
- Derived
- Inherited Members
Constructors
XunitTestRunnerBaseContext(TTest, IMessageBus, ExplicitOption, ExceptionAggregator, CancellationTokenSource, IReadOnlyCollection<IBeforeAfterTestAttribute>, object?[])
Initializes a new instance of the XunitTestRunnerBaseContext<TTest> class.
public XunitTestRunnerBaseContext(TTest test, IMessageBus messageBus, ExplicitOption explicitOption, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource, IReadOnlyCollection<IBeforeAfterTestAttribute> beforeAfterTestAttributes, object?[] constructorArguments)
Parameters
testTTestThe test
messageBusIMessageBusThe message bus to send execution messages to
explicitOptionExplicitOptionThe user's choice on how to treat explicit tests
aggregatorExceptionAggregatorThe exception aggregator
cancellationTokenSourceCancellationTokenSourceThe cancellation token source
beforeAfterTestAttributesIReadOnlyCollection<IBeforeAfterTestAttribute>The IBeforeAfterTestAttributes that are applied to the test
constructorArgumentsobject[]The constructor arguments for the test class
Properties
BeforeAfterTestAttributes
Gets the collection of IBeforeAfterTestAttribute used for this test.
public IReadOnlyCollection<IBeforeAfterTestAttribute> BeforeAfterTestAttributes { get; }
Property Value
ConstructorArguments
Gets the arguments that should be passed to the test class when it's constructed.
public object?[] ConstructorArguments { get; }
Property Value
- object[]
Methods
GetSkipReason(Exception?)
Gets the runtime skip reason for the test, inspecting the provided exception to see if it contractually matches a "dynamically skipped" exception (that is, any exception message that starts with Value). If the exception does not match the pattern, consults the base skip reason (from Skip), as well as SkipUnless and SkipWhen to determine if the test should be dynamically skipped.
public override string? GetSkipReason(Exception? exception)
Parameters
exceptionExceptionThe exception to inspect
Returns
- string
The skip reason, if the test is skipped;
null, otherwise
RunAfterAttributes()
Runs the After(MethodInfo, IXunitTest) side of the before after attributes.
public void RunAfterAttributes()
RunBeforeAttributes()
Runs the Before(MethodInfo, IXunitTest) side of the before after attributes.
public void RunBeforeAttributes()