Table of Contents

Class MessageMetadataCache

Namespace
Xunit.Runner.Common
Assembly
xunit.v3.runner.common.dll

Caches message metadata for xUnit.net v3 messages. The metadata which is cached depends on the message that is passed (for example, looking up with an ITestAssemblyMessage will return an IAssemblyMetadata). Storage methods require the "Starting" versions of messages (as these are the ones which contain the metadata), and removal methods require the "Finished" versions of messages.

public class MessageMetadataCache
Inheritance
MessageMetadataCache
Inherited Members

Methods

Set(ITestAssemblyStarting)

Sets IAssemblyMetadata into the cache.

public void Set(ITestAssemblyStarting message)

Parameters

message ITestAssemblyStarting

The message that contains the metadata.

Set(ITestCaseStarting)

Sets ITestCaseMetadata into the cache.

public void Set(ITestCaseStarting message)

Parameters

message ITestCaseStarting

The message that contains the metadata.

Set(ITestClassStarting)

Sets ITestClassMetadata into the cache.

public void Set(ITestClassStarting message)

Parameters

message ITestClassStarting

The message that contains the metadata.

Set(ITestCollectionStarting)

Sets ITestCollectionMetadata into the cache.

public void Set(ITestCollectionStarting message)

Parameters

message ITestCollectionStarting

The message that contains the metadata.

Set(ITestMethodStarting)

Sets ITestMethodMetadata into the cache.

public void Set(ITestMethodStarting message)

Parameters

message ITestMethodStarting

The message that contains the metadata.

Set(ITestStarting)

Sets ITestMetadata into the cache.

public void Set(ITestStarting message)

Parameters

message ITestStarting

The message that contains the metadata.

TryGetAssemblyMetadata(string, bool)

Attempts to retrieve IAssemblyMetadata from the cache (and optionally remove it).

public IAssemblyMetadata? TryGetAssemblyMetadata(string assemblyUniqueID, bool remove = false)

Parameters

assemblyUniqueID string

The unique ID of the assembly to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

IAssemblyMetadata

The cached metadata, if present; or null if there isn't any.

TryGetAssemblyMetadata(ITestAssemblyMessage)

Attempts to retrieve IAssemblyMetadata from the cache.

public IAssemblyMetadata? TryGetAssemblyMetadata(ITestAssemblyMessage message)

Parameters

message ITestAssemblyMessage

The message that indicates which metadata to retrieve.

Returns

IAssemblyMetadata

The cached metadata, if present; or null if there isn't any.

TryGetClassMetadata(string, bool)

Attempts to retrieve ITestClassMetadata from the cache (and optionally remove it).

public ITestClassMetadata? TryGetClassMetadata(string testClassUniqueID, bool remove = false)

Parameters

testClassUniqueID string

The unique ID of the test class to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

ITestClassMetadata

The cached metadata, if present; or null if there isn't any.

TryGetClassMetadata(ITestClassMessage)

Attempts to retrieve ITestClassMetadata from the cache.

public ITestClassMetadata? TryGetClassMetadata(ITestClassMessage message)

Parameters

message ITestClassMessage

The message that indicates which metadata to retrieve.

Returns

ITestClassMetadata

The cached metadata, if present; or null if there isn't any.

TryGetCollectionMetadata(string, bool)

Attempts to retrieve ITestCollectionMetadata from the cache (and optionally remove it).

public ITestCollectionMetadata? TryGetCollectionMetadata(string testCollectionUniqueID, bool remove = false)

Parameters

testCollectionUniqueID string

The unique ID of the test collection to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

ITestCollectionMetadata

The cached metadata, if present; or null if there isn't any.

TryGetCollectionMetadata(ITestCollectionMessage)

Attempts to retrieve ITestCollectionMetadata from the cache.

public ITestCollectionMetadata? TryGetCollectionMetadata(ITestCollectionMessage message)

Parameters

message ITestCollectionMessage

The message that indicates which metadata to retrieve.

Returns

ITestCollectionMetadata

The cached metadata, if present; or null if there isn't any.

TryGetMethodMetadata(string, bool)

Attempts to retrieve ITestMethodMetadata from the cache (and optionally remove it).

public ITestMethodMetadata? TryGetMethodMetadata(string testMethodUniqueID, bool remove = false)

Parameters

testMethodUniqueID string

The unique ID of the test method to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

ITestMethodMetadata

The cached metadata, if present; or null if there isn't any.

TryGetMethodMetadata(ITestMethodMessage)

Attempts to retrieve ITestMethodMetadata from the cache.

public ITestMethodMetadata? TryGetMethodMetadata(ITestMethodMessage message)

Parameters

message ITestMethodMessage

The message that indicates which metadata to retrieve.

Returns

ITestMethodMetadata

The cached metadata, if present; or null if there isn't any.

TryGetTestCaseMetadata(string, bool)

Attempts to retrieve ITestCaseMetadata from the cache (and optionally remove it).

public ITestCaseMetadata? TryGetTestCaseMetadata(string testCaseUniqueID, bool remove = false)

Parameters

testCaseUniqueID string

The unique ID of the test case to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

ITestCaseMetadata

The cached metadata, if present; or null if there isn't any.

TryGetTestCaseMetadata(ITestCaseMessage)

Attempts to retrieve ITestCaseMetadata from the cache.

public ITestCaseMetadata? TryGetTestCaseMetadata(ITestCaseMessage message)

Parameters

message ITestCaseMessage

The message that indicates which metadata to retrieve.

Returns

ITestCaseMetadata

The cached metadata, if present; or null if there isn't any.

TryGetTestMetadata(string, bool)

Attempts to retrieve ITestMetadata from the cache (and optionally remove it).

public ITestMetadata? TryGetTestMetadata(string testUniqueID, bool remove = false)

Parameters

testUniqueID string

The unique ID of the test to retrieve.

remove bool

Set to true to remove the metadata after retrieval.

Returns

ITestMetadata

The cached metadata, if present; or null if there isn't any.

TryGetTestMetadata(ITestMessage)

Attempts to retrieve ITestMetadata from the cache.

public ITestMetadata? TryGetTestMetadata(ITestMessage message)

Parameters

message ITestMessage

The message that indicates which metadata to retrieve.

Returns

ITestMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestAssemblyFinished)

Attempts to retrieve IAssemblyMetadata from the cache, and if present, removes the metadata from the cache.

public IAssemblyMetadata? TryRemove(ITestAssemblyFinished message)

Parameters

message ITestAssemblyFinished

The message that indicates which metadata to retrieve.

Returns

IAssemblyMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestCaseFinished)

Attempts to retrieve ITestCaseMetadata from the cache, and if present, removes the metadata from the cache.

public ITestCaseMetadata? TryRemove(ITestCaseFinished message)

Parameters

message ITestCaseFinished

The message that indicates which metadata to retrieve.

Returns

ITestCaseMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestClassFinished)

Attempts to retrieve ITestClassMetadata from the cache, and if present, removes the metadata from the cache.

public ITestClassMetadata? TryRemove(ITestClassFinished message)

Parameters

message ITestClassFinished

The message that indicates which metadata to retrieve.

Returns

ITestClassMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestCollectionFinished)

Attempts to retrieve ITestCollectionMetadata from the cache, and if present, removes the metadata from the cache.

public ITestCollectionMetadata? TryRemove(ITestCollectionFinished message)

Parameters

message ITestCollectionFinished

The message that indicates which metadata to retrieve.

Returns

ITestCollectionMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestFinished)

Attempts to retrieve ITestMetadata from the cache, and if present, removes the metadata from the cache.

public ITestMetadata? TryRemove(ITestFinished message)

Parameters

message ITestFinished

The message that indicates which metadata to retrieve.

Returns

ITestMetadata

The cached metadata, if present; or null if there isn't any.

TryRemove(ITestMethodFinished)

Attempts to retrieve ITestMethodMetadata from the cache, and if present, removes the metadata from the cache.

public ITestMethodMetadata? TryRemove(ITestMethodFinished message)

Parameters

message ITestMethodFinished

The message that indicates which metadata to retrieve.

Returns

ITestMethodMetadata

The cached metadata, if present; or null if there isn't any.