Example #1
0
        public void TestCompleteAsyncTask()
        {
            var task = new SampleWorkflow().executeAsync(3);

            task.Wait();
            Assert.AreEqual(task.Result, 3);
        }
Example #2
0
        public void TestProgressOfAsyncTask2()
        {
            Double progressResult = .0;
              var progress = new Progress<Double>();
              progress.ProgressChanged += (s, e) => {
            progressResult = e;
              };

              var task = new SampleWorkflow().executeAsync(3, progress);
              task.Wait();

              Assert.AreEqual(3, task.Result);
              Assert.AreEqual(100.0, progressResult);
        }
Example #3
0
 public void TestCancelAsyncTask()
 {
     var cancelTknSrc = new CancellationTokenSource();
       var task = new SampleWorkflow().executeAsync(3, cancelTknSrc.Token);
       cancelTknSrc.Cancel();
       try
       {
     task.Wait();
       }
       catch (AggregateException e)
       {
     throw e.InnerException;
       }
 }
Example #4
0
        public void TestCancelAsyncTask()
        {
            var cancelTknSrc = new CancellationTokenSource();
            var task         = new SampleWorkflow().executeAsync(3, cancelTknSrc.Token);

            cancelTknSrc.Cancel();
            try
            {
                task.Wait();
            }
            catch (AggregateException e)
            {
                throw e.InnerException;
            }
        }
Example #5
0
        public void TestProgressOfAsyncTask2()
        {
            Double progressResult = .0;
            var    progress       = new Progress <Double>();

            progress.ProgressChanged += (s, e) => {
                progressResult = e;
            };

            var task = new SampleWorkflow().executeAsync(3, progress);

            task.Wait();

            Assert.AreEqual(3, task.Result);
            Assert.AreEqual(100.0, progressResult);
        }
Example #6
0
 public void TestCompleteAsyncTask()
 {
     var task = new SampleWorkflow().executeAsync(3);
       task.Wait();
       Assert.AreEqual(task.Result, 3);
 }