public void ResultReturnedByEndInvoke() { AsyncResult<bool> asyncResult = new AsyncResult<bool>(null, null); Assert.IsFalse(asyncResult.IsCompleted); Assert.IsFalse(asyncResult.CompletedSynchronously); Assert.AreEqual(null, asyncResult.AsyncState); asyncResult.SetAsCompleted(true, false); Assert.IsTrue(asyncResult.EndInvoke()); }
/// <summary> /// Sets the test up. Creates an instance of the <see cref="AsyncResult"/> and checks if /// was properly created. /// </summary> /// <param name="callbackMethod">The callback method.</param> /// <param name="state">The state.</param> private void SetUp(AsyncCallback callbackMethod, object state) { this.asyncResult = new AsyncResult(callbackMethod, state, this.initialLeaseTime, this.sponsorshipTimeout); Assert.IsFalse(this.asyncResult.IsCompleted); Assert.IsFalse(this.asyncResult.CompletedSynchronously); Assert.AreEqual(state, this.asyncResult.AsyncState); }