source/TestCommon/source/TestCommon/Awaiter.cs
/// <summary>
/// Completes when the "condition" returns true or
/// when the time limit is exceeded and then false is returned.
/// </summary>
/// <param name="condition">Boolean condition that is checked.</param>
/// <param name="timeLimit">Time limit until false is returned</param>
/// <param name="delay">Delay between each check on the condition</param>
/// <returns>True when condition resolves to true and false when the time limit is exceeded</returns>
Completes when the "condition" returns true or
when the time limit is exceeded and then false is returned.
Completes when the " condition " returns true or when the time limit is exceeded and then false is returned .
public static async Task<bool> TryWaitUntilConditionAsync(Func<bool> condition, TimeSpan timeLimit, TimeSpan? delay = null)
        {
            var startTime = Environment.TickCount;
            while (!condition())
            {
                if (!await CheckMaxWaitAndDelayAsync(timeLimit.TotalMilliseconds, startTime, delay).ConfigureAwait(false))
                {
                    return false;
                }
            }
            return true;
        }
public static async Task < bool > TryWaitUntilConditionAsync ( Func < bool > condition , TimeSpan timeLimit , TimeSpan ? delay = null ) { var startTime = Environment . TickCount ; while ( ! condition ( ) ) { if ( ! await CheckMaxWaitAndDelayAsync ( timeLimit . TotalMilliseconds , startTime , delay ) . ConfigureAwait ( false ) ) { return false ; } } return true ; }
Completes when the "condition" returns true or
when the time limit is exceeded and then false is returned.
Completes when the " condition " returns true or when the time limit is exceeded and then false is returned .
True when condition resolves to true and false when the time limit is exceeded
True when condition resolves to true and false when the time limit is exceeded
condition
Func<bool>
Boolean condition that is checked.
Boolean condition that is checked .
timeLimit
TimeSpan
Time limit until false is returned
Time limit until false is returned
delay
TimeSpan?
Delay between each check on the condition
Delay between each check on the condition