Method Find
- Namespace
- Xunit.v3
- Assembly
- xunit.v3.core.dll
Find(IMessageSink?, ITestFrameworkDiscoveryOptions, Func<ITestCase, bool>, Type[]?, Func<ITestCase, bool, ValueTask<bool>>?)
Starts the process of finding tests in an assembly. Typically only used by runners which discover tests and present them into a UI for the user to interactively choose for selective run (via Run(IMessageSink, ITestFrameworkExecutionOptions, IReadOnlyCollection<ITestCase>)). For runners which simply wish to discover and immediately run tests, they should instead use FindAndRun(IMessageSink, ITestFrameworkDiscoveryOptions, ITestFrameworkExecutionOptions, Func<ITestCase, bool>, Type[]?), which permits the same filtering logic as this method.
public ValueTask Find(IMessageSink? messageSink, ITestFrameworkDiscoveryOptions options, Func<ITestCase, bool> filter, Type[]? types = null, Func<ITestCase, bool, ValueTask<bool>>? discoveryCallback = null)
Parameters
messageSinkThe message sink to report discovery starting and discovery complete messages to. Discovered tests are not reported to this message sink, since it's also used for FindAndRun(IMessageSink, ITestFrameworkDiscoveryOptions, ITestFrameworkExecutionOptions, Func<ITestCase, bool>, Type[]?), so it is assumed that callers to this method will use the
discoveryCallbackto report discovered tests if needed.optionsThe options to be used for discovery.
filterFunc<ITestCase, bool>The filter function for filtering test cases.
typesType[]When passed a non-
nullcollection, only returns tests found from one of the provided types; when passed anullcollection, discovers all tests in the assembly.discoveryCallbackFunc<ITestCase, bool, ValueTask<bool>>An optional callback to be called for each discovered test case. It provides both the test case and a flag which indicates if it passed the provided filter.