Skip to content

TestingUtils.WaitUntilSucceededAsync(Func<CancellationToken, Task<bool>>, TimeSpan, TimeSpan?, CancellationToken)

WaitUntilSucceededAsync(Func<CancellationToken, Task<bool>>, TimeSpan, TimeSpan?, CancellationToken)

static
View source
public static Task<bool> WaitUntilSucceededAsync(Func<CancellationToken, Task<bool>> predicate, TimeSpan timeout, TimeSpan? delayOnFail = null, CancellationToken cancellationToken = default(CancellationToken))
Runs the predicate until it succeeds or the monotonic deadline expires.

Parameters

predicateFunc<CancellationToken, Task<bool>>
The predicate to run. The token is cancelled when the deadline expires or cancellation is requested.
timeoutTimeSpan
The timeout value.
delayOnFailTimeSpan?
The delay before retrying after an unsuccessful attempt.
cancellationTokenCancellationToken
The cancellation token.

Returns

true if the predicate succeeded before the deadline; otherwise, false.