Table of Contents

Class XunitTestCase

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

Default implementation of IXunitTestCase for xUnit.net v3 that supports test methods decorated with FactAttribute. Test methods decorated with derived attributes may use this as a base class to build from.

public class XunitTestCase : IXunitTestCase, ITestCase, ITestCaseMetadata, IXunitSerializable, IAsyncDisposable
Inheritance
XunitTestCase
Implements
Derived
Inherited Members

Constructors

XunitTestCase()

Called by the de-serializer; should only be called by deriving classes for de-serialization purposes

XunitTestCase(IXunitTestMethod, string, string, bool, Type[]?, string?, Type?, string?, string?, Dictionary<string, HashSet<string>>?, object?[]?, string?, int?, int?)

Initializes a new instance of the XunitTestCase class.

Properties

DisposalTracker

Used to dispose of test method arguments when the test case is disposed.

Explicit

Gets a flag indicating whether this test case was marked as explicit or not.

SkipExceptions

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

SkipReason

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

SkipType

When set, indicates the type to use when resolving SkipUnless or SkipWhen. If not set, uses the test class 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).

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).

SourceFilePath

Gets the source file name. A null value indicates that the source file name is not known.

SourceLineNumber

Gets the source file line number. A null value indicates that the source file line number is not known.

TestCaseDisplayName

Gets the display name of the test case.

TestClass

Gets the test class that this test case belongs to.

TestClassMetadataToken

Gets the MetadataToken for the test class.

TestClassName

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

TestClassNamespace

Gets the namespace of the class where the test is defined. If the test did not originate in a class, or the class it originated in does not reside in a namespace, will return null.

TestClassSimpleName

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

TestCollection

Gets the test collection this test case belongs to.

TestMethod

Gets the test method this test case belongs to.

TestMethodArguments
TestMethodMetadataToken

Gets the MetadataToken for the test method.

TestMethodName

Gets the method name where the test is defined.

TestMethodParameterTypesVSTest

Gets the types for the test method parameters.

TestMethodReturnTypeVSTest

Gets the test method return type.

Timeout

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

Traits

Gets the traits associated with this test case.

UniqueID

Gets a unique identifier for the test case.

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.

Deserialize(IXunitSerializationInfo)

Called when the test case should populate itself with data from the serialization info.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

PostInvoke()

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

PreInvoke()

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

ResolveTestMethodArguments(ParameterInfo[], object?[])

Computes values from the test case and resolves the test method arguments just before execution. Typically used from CreateTests() so that the executed test has an appropriately typed argument, regardless of the type that was used to serialize the argument.

Serialize(IXunitSerializationInfo)

Called when the test case should store its serialized values into the serialization info.