Method TryGetFixtureArgument
- Namespace
- Xunit.v3
- Assembly
- xunit.v3.core.aot.dll
TryGetFixtureArgument<T>()
Tries to get a fixture argument to help construct a fixture. The potential fixed argument types are supported (e.g., IMessageSink and ITestContextAccessor), as well as consulting the parent mapping manager.
public ValueTask<(bool Success, T? Result)> TryGetFixtureArgument<T>()
Returns
Type Parameters
TThe fixture argument type to supply
Remarks
This differs from TryGetFixture<T>(), which only returns fixture values and not additional supported argument types.
TryGetFixtureArgument<T>(FixtureMappingManager?)
Tries to get a fixture argument to help construct a fixture. The potential fixed argument types are supported (e.g., IMessageSink, ITestContextAccessor, and ITestOutputHelper), as well as consulting the mapping manager.
public static ValueTask<(bool Success, T? Result)> TryGetFixtureArgument<T>(FixtureMappingManager? mappingManager)
Parameters
mappingManagerThe fixture mapping manager to get fixture instances from
Returns
Type Parameters
TThe fixture argument type to supply
Remarks
This is typically only used in Native AOT, since the current lifetime management for reflection-based testing would require a delayed retrieval of ITestOutputHelper, whereas the code generation-based runners delay resolution until just as the test is about to run.