void bg_DoWork(object sender, DoWorkEventArgs e) { var ops = new AsyncOperations(); var result = ops.GetRandomNumber(10); e.Result = result; }
public async Task FakeParallelAsync() { var asyncOps = new AsyncOperations(); var result = await asyncOps.MultipleCallsParallelAsync(); Assert.IsTrue(result > 0); }
public void FakeParallelResult() { var asyncOps = new AsyncOperations(); var result = asyncOps.ParallelSync(); Assert.IsTrue(result > 0); }
public void FakeCallTest() { var asyncOps = new AsyncOperations(); var result = asyncOps.GetRandomNumber(5); Assert.IsTrue(result > 0); }
public async Task FakeCallTestAsync() { var asyncOps = new AsyncOperations(); var result = await asyncOps.GetRandomNumberAsync(5); Assert.IsTrue(result > 0); }
public JsonResult SyncMethod() { var ops = new AsyncOperations(); var result = ops.GetRandomNumber(10); return(Json(new { number = result }, JsonRequestBehavior.AllowGet)); }
// GET: DemoNew public async Task <JsonResult> AsyncMethod() { var ops = new AsyncOperations(); var result = await ops.GetRandomNumberAsync(10); return(Json(new { number = result }, JsonRequestBehavior.AllowGet)); }
public AsyncOperation(AsyncOperations op, AsyncOpCallback callback, object param, object pwner) { this.op = op; this.callback = callback; this.param = param; this.pwner = pwner; RequiresSignIn = true; }