Ejemplo n.º 1
0
        internal static void SafeNotCompletes(IAsyncResult ar, string opName, TimeSpan timeout)
        {
            //
            bool signalled = ar.AsyncWaitHandle.WaitOne(TestsUtils.TimespanToMilliseconds(timeout), false);

            if (signalled)
            {
                throw new InvalidOperationException("Unxpected completion by " + opName + "!");
            }
        }
Ejemplo n.º 2
0
        public static void SafeNoHangWait(IAsyncResult ar, string opName, TimeSpan timeout)
        {
            if (ar.IsCompleted)
            {
                return;
            }
            bool signalled = ar.AsyncWaitHandle.WaitOne(TestsUtils.TimespanToMilliseconds(timeout), false);

            if (!signalled)
            {
                throw new InvalidOperationException("Test timeout at " + opName);
            }
        }