Class TestHostBag
- Namespace
- Mokkit.Suite
- Assembly
- Mokkit.dll
Represents a thread-safe collection for storing and retrieving test-related objects by their type. This class provides a type-based storage mechanism that allows test components to share data and services across test execution phases.
public class TestHostBagInheritance
Inherited Members
Methods
TryAdd(Type, object)
Attempts to add an object to the bag with the specified service type as the key. If an object with the same type already exists, this method will not replace it.
public void TryAdd(Type serviceType, object implementation)Parameters
serviceTypeType-
The type to use as the key for storing the object.
implementationobject-
The object instance to store in the bag.
TryGet(Type)
Attempts to retrieve an object from the bag using the specified service type as the key.
public object? TryGet(Type serviceType)Parameters
serviceTypeType-
The type to use as the key for retrieving the object.
Returns
- object?
-
The object associated with the specified type, or
nullif no object is found.