public void ResultReturnedByEndInvoke() { AsyncResult<bool> asyncResult = new AsyncResult<bool>(null, null); asyncResult.IsCompleted.Should().BeFalse(); asyncResult.CompletedSynchronously.Should().BeFalse(); asyncResult.AsyncState.Should().BeNull(); asyncResult.SetAsCompleted(true, false); asyncResult.EndInvoke().Should().BeTrue(); }
/// <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); }