public void CancelButNotInterruptBeforeRun()
 {
     FutureTask<string> ft = new FutureTask<string>(new FooCallable1());
     Assert.IsTrue(ft.Cancel(false));
     ft.Run();
     Assert.IsTrue(ft.IsDone);
     Assert.IsTrue(ft.IsCancelled);
 }
 public void CancelAndInterruptTheRunningTask()
 {
     FutureTask<int> ft = new FutureTask<int>(new InmediatlyCallable(13));
     ft.Run();
     Assert.IsFalse(ft.Cancel(true));
     Assert.IsTrue(ft.IsDone);
     Assert.IsFalse(ft.IsCancelled);
 }
示例#3
0
 public void CancelAndInterruptBeforeRun()
 {
     var ft = new FutureTask<string>(new FooCallable1());
     ft.Cancel(true);
     ft.Run();
     Assert.IsTrue(ft.IsDone);
     Assert.IsTrue(ft.IsCancelled);
 }
示例#4
0
        public void CancelButNotInterruptBeforeRun()
        {
            var ft = new FutureTask <string>(new FooCallable1());

            Assert.IsTrue(ft.Cancel(false));
            ft.Run();
            Assert.IsTrue(ft.IsDone);
            Assert.IsTrue(ft.IsCancelled);
        }
示例#5
0
        public void CancelAndInterruptTheRunningTask()
        {
            var ft = new FutureTask <int>(new InmediatlyCallable(13));

            ft.Run();
            Assert.IsFalse(ft.Cancel(true));
            Assert.IsTrue(ft.IsDone);
            Assert.IsFalse(ft.IsCancelled);
        }
        public void IsDoneIsCanceledAndGet()
        {
            FutureTask<int> ft = new FutureTask<int>(new InmediatlyCallable(13));

            Assert.AreEqual(false, ft.IsDone);
            Assert.AreEqual(false, ft.IsCancelled);

            ft.Run();

            Assert.AreEqual(13, ft.Get()); //The result

            Assert.AreEqual(true, ft.IsDone);
            Assert.AreEqual(false, ft.IsCancelled);
        }
示例#7
0
        public void IsDoneIsCanceledAndGet()
        {
            var ft = new FutureTask <int>(new InmediatlyCallable(13));

            Assert.AreEqual(false, ft.IsDone);
            Assert.AreEqual(false, ft.IsCancelled);

            ft.Run();

            Assert.AreEqual(13, ft.Get());             //The result

            Assert.AreEqual(true, ft.IsDone);
            Assert.AreEqual(false, ft.IsCancelled);
        }