Table of Contents

Interface IXunitTestCase

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

Represents a single test case from xUnit.net v3 based on reflection.

public interface IXunitTestCase : ITestCase, ITestCaseMetadata
Inherited Members

Properties

SkipExceptions

Gets the exception types that, when thrown, will cause a

Type[]? SkipExceptions { get; }

Property Value

Type[]

SkipReason

Gets the display text for the reason a test that might being skipped.

string? SkipReason { get; }

Property Value

string

Remarks

This differs from the contract of SkipReason by virtue of the fact that when this value is non-null, it may indicate that a test is statically skipped (if both SkipUnless and SkipWhen are null) or dynamically skipped (if one is non-null).

SkipType

When set, indicates the type to use when resolving SkipUnless or SkipWhen. If not set, uses the test class type.

Type? SkipType { get; }

Property Value

Type

SkipUnless

When set, indicates a public static property that is used at runtime to determine whether the test is skipped or not (true to run, false to skip).

string? SkipUnless { get; }

Property Value

string

Remarks

Note: It is an error condition for both SkipUnless and SkipWhen to return a non-null value.

SkipWhen

When set, indicates a public static property that is used at runtime to determine whether the test is skipped or not (false to run, true to skip).

string? SkipWhen { get; }

Property Value

string

Remarks

Note: It is an error condition for both SkipUnless and SkipWhen to return a non-null value.

TestClass

Gets the test class that this test case belongs to.

IXunitTestClass TestClass { get; }

Property Value

IXunitTestClass

TestClassMetadataToken

Gets the MetadataToken for the test class.

int TestClassMetadataToken { get; }

Property Value

int

TestClassName

Gets the full name of the class where the test is defined (i.e. FullName).

string TestClassName { get; }

Property Value

string

TestClassSimpleName

Gets the simple name of the class where the test is defined (i.e. Name).

string TestClassSimpleName { get; }

Property Value

string

TestCollection

Gets the test collection this test case belongs to.

IXunitTestCollection TestCollection { get; }

Property Value

IXunitTestCollection

TestMethod

Gets the test method this test case belongs to.

IXunitTestMethod TestMethod { get; }

Property Value

IXunitTestMethod

TestMethodMetadataToken

Gets the MetadataToken for the test method.

int TestMethodMetadataToken { get; }

Property Value

int

TestMethodName

Gets the method name where the test is defined.

string TestMethodName { get; }

Property Value

string

TestMethodParameterTypesVSTest

Gets the types for the test method parameters.

string[] TestMethodParameterTypesVSTest { get; }

Property Value

string[]

Remarks

The values here are formatted according to VSTest rules in order to support Test Explorer. Note that this is not the same as FullName.

TestMethodReturnTypeVSTest

Gets the test method return type.

string TestMethodReturnTypeVSTest { get; }

Property Value

string

Remarks

The value here is formatted according to VSTest rules in order to support Test Explorer. Note that this is not the same as FullName.

Timeout

Gets the timeout of the test, in milliseconds; if zero or negative, means the test case has no timeout.

int Timeout { get; }

Property Value

int

Methods

CreateTests()

Creates the tests that are emitted from this test case. Exceptions thrown here will be caught and converted into a test case failure.

ValueTask<IReadOnlyCollection<IXunitTest>> CreateTests()

Returns

ValueTask<IReadOnlyCollection<IXunitTest>>

PostInvoke()

Allows the test case to run some code just after the test case is finished running.

void PostInvoke()

PreInvoke()

Allows the test case to run some code just before the test case is run.

void PreInvoke()