Table of Contents

Class TestMethodCleanupFailure

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

Default implementation of ITestMethodCleanupFailure.

[JsonTypeID("test-method-cleanup-failure")]
public sealed class TestMethodCleanupFailure : TestMethodMessage, ITestMethodCleanupFailure, ITestMethodMessage, ITestClassMessage, ITestCollectionMessage, ITestAssemblyMessage, IMessageSinkMessage, IJsonSerializable, IErrorMetadata
Inheritance
TestMethodCleanupFailure
Implements
Inherited Members

Properties

ExceptionParentIndices

Gets the parent exception index(es) for the exception(s); a -1 indicates that the exception in question has no parent.

public required int[] ExceptionParentIndices { get; set; }

Property Value

int[]

ExceptionTypes

Gets the fully-qualified type name(s) of the exception(s).

public required string?[] ExceptionTypes { get; set; }

Property Value

string[]

Messages

Gets the message(s) of the exception(s).

public required string[] Messages { get; set; }

Property Value

string[]

StackTraces

Gets the stack trace(s) of the exception(s).

public required string?[] StackTraces { get; set; }

Property Value

string[]

Methods

FromException(Exception, string, string, string?, string?)

Creates a new ITestMethodCleanupFailure constructed from an Exception object.

public static ITestMethodCleanupFailure FromException(Exception ex, string assemblyUniqueID, string testCollectionUniqueID, string? testClassUniqueID, string? testMethodUniqueID)

Parameters

ex Exception

The exception to use

assemblyUniqueID string

The unique ID of the assembly

testCollectionUniqueID string

The unique ID of the test collectioon

testClassUniqueID string

The (optional) unique ID of the test class

testMethodUniqueID string

The (optional) unique ID of the test method

Returns

ITestMethodCleanupFailure

Serialize(JsonObjectSerializer)

Override to serialize the values in the message into JSON.

protected override void Serialize(JsonObjectSerializer serializer)

Parameters

serializer JsonObjectSerializer

The serializer to write values to.

ToString()

public override string ToString()

Returns

string

ValidateObjectState(HashSet<string>)

Called before serializing the message. Implementers are expected to call ValidatePropertyIsNotNull(object?, string, HashSet<string>) for each property that must have a value, to record invalid property values into the provided hash set.

protected override void ValidateObjectState(HashSet<string> invalidProperties)

Parameters

invalidProperties HashSet<string>

The hash set to record invalid properties into