public void CompleteTwice() { this.completionCallbackInvocations = 0; this.completionCallbackState = null; AsyncResult ar = new AsyncResult(CompletionCallback, asyncState); ar.Completed(); ar.Completed(); Assert.AreEqual(1, this.completionCallbackInvocations, "completionCallbackInvocations"); bool waitResult = ar.AsyncWaitHandle.WaitOne(500, false); Assert.IsTrue(waitResult, "WaitOne result"); Assert.AreSame(asyncState, this.completionCallbackState, "completionCallbackState"); }
internal void ProcessError(Exception error) { if (AsyncResult != null) { AsyncResult.Completed(null, error); } }