예제 #1
0
        void bg_DoWork(object sender, DoWorkEventArgs e)
        {
            var ops    = new AsyncOperations();
            var result = ops.GetRandomNumber(10);

            e.Result = result;
        }
예제 #2
0
        public async Task FakeParallelAsync()
        {
            var asyncOps = new AsyncOperations();
            var result   = await asyncOps.MultipleCallsParallelAsync();

            Assert.IsTrue(result > 0);
        }
예제 #3
0
        public void FakeParallelResult()
        {
            var asyncOps = new AsyncOperations();
            var result   = asyncOps.ParallelSync();

            Assert.IsTrue(result > 0);
        }
예제 #4
0
        public void  FakeCallTest()
        {
            var asyncOps = new AsyncOperations();
            var result   = asyncOps.GetRandomNumber(5);

            Assert.IsTrue(result > 0);
        }
예제 #5
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));
        }
예제 #8
0
        public AsyncOperation(AsyncOperations op, AsyncOpCallback callback, object param, object pwner)
        {
            this.op       = op;
            this.callback = callback;
            this.param    = param;
            this.pwner    = pwner;

            RequiresSignIn = true;
        }