Esempio n. 1
0
        internal State FindState(State[] states, Scope scope, Options options)
        {
            var query = new LambdaPredicateQuery(() =>
            {
                var was = timingStrategy.ZeroTimeout;
                timingStrategy.ZeroTimeout = true;
                try
                {
                    return ((Func<bool>)(() => states.Any(s => s.CheckCondition())))();
                }
                finally
                {
                    timingStrategy.ZeroTimeout = was;
                }
            }, options);

            var foundState = timingStrategy.Synchronise(query);

            if (!foundState)
                throw new MissingHtmlException("None of the given states was reached within the configured timeout.");

            return states.First(e => e.ConditionWasMet);
        }
Esempio n. 2
0
        internal State FindState(Options options, params State[] states)
        {
            var query = new LambdaPredicateQuery(() =>
            {
                var was = robustWrapper.ZeroTimeout;
                robustWrapper.ZeroTimeout = true;
                try
                {
                    return ((Func<bool>)(() => states.Any(s => s.CheckCondition())))();
                }
                finally
                {
                    robustWrapper.ZeroTimeout = was;
                }
            }, options);

            var foundState = robustWrapper.Robustly(query);

            if (!foundState)
                throw new MissingHtmlException("None of the given states was reached within the configured timeout.");

            return states.First(e => e.ConditionWasMet);
        }