예제 #1
0
        private static bool IsTrue <T>(this EventualAssertions <T> that,
                                       Predicate <T> predicate,
                                       TimeSpan maximumWaitTime,
                                       out T finalValue)
        {
            var started = DateTime.UtcNow;

            do
            {
                finalValue = that.GetValue();
                if (predicate(finalValue))
                {
                    return(true);
                }

                Thread.Sleep(EventualAssertions <int> .DefaultSleepTime);
            } while (DateTime.UtcNow - started < maximumWaitTime);

            return(false);
        }