public void Completed() { AsyncResult ar = new AsyncResult(null, this); ar.SetComplete(); Assert.True(ar.IsCompleted); }
public void CompletedSynchronouslyProperty() { AsyncResult ar = new AsyncResult(null, this); ar.SetComplete(true, null); Assert.True(ar.IsCompleted); Assert.True(ar.CompletedSynchronously); }
public void CallBack() { CallBackHelper callBackRecorder = new CallBackHelper(); AsyncResult ar = new AsyncResult(callBackRecorder.CallBack, this); ar.SetComplete(); Assert.Same(ar, callBackRecorder.Result); }
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { Debug.WriteLine(string.Format("Request recieved on thread {0}", Thread.CurrentThread.ManagedThreadId)); AsyncResult result = new AsyncResult(cb, context); ThreadingUtility.QueueWorkItem(ProcessRequestAsync, result); return result; }
public virtual IAsyncResult BeginDoTask(AsyncCallback callback, Object state) { AsyncResult ar = new AsyncResult(callback, state); if (_wait > 0) { ThreadPool.QueueUserWorkItem(QueueableDoTask, ar); } else { ar.SetComplete(true, _terminatingException); } return ar; }
public override IAsyncResult BeginExecuteQuery(Expression query, AsyncCallback callback) { // TODO: should we really accept SpatialBinaryExpression here? It makes it more flexible, // but could also make it hard to find problems Expression featureQuery = query as FeatureQueryExpression ?? (Expression)(query as SpatialBinaryExpression); if (featureQuery == null) { throw new ArgumentException("Query must be non-null " + "and of type FeatureQueryExpression " + "or SpatialBinaryExpression.", "query"); } AsyncResult<IFeatureDataReader> asyncResult = new AsyncResult<IFeatureDataReader>(callback, query); ThreadPool.QueueUserWorkItem(queueableBeginQuery, asyncResult); return asyncResult; }
public void GetState() { AsyncResult<String> ar = new AsyncResult<String>(null, this); Assert.Same(this, ar.AsyncState); }
public void Constructs() { AsyncResult<String> ar = new AsyncResult<String>(null, this); }
public void AsyncWaitHandle() { AsyncResult ar = new AsyncResult(null, this); Assert.NotNull(ar.AsyncWaitHandle); }
public void Incomplete() { AsyncResult ar = new AsyncResult(null, this); Assert.False(ar.IsCompleted); }
public void Constructs() { AsyncResult ar = new AsyncResult(null, this); }
public void EndExecuteQueryThrowsOnInvalidExpression() { MockRepository mocks = new MockRepository(); IRasterProvider adapted = MockRepository.GenerateStub<IRasterProvider>(); AsyncResult result = new AsyncResult(null, this); AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted); Assert.Throws<ArgumentException>(delegate { adapter.EndExecuteQuery(result); }); }