public void ContinuationOnBrokenScheduler()
        {
            var  s = new ExceptionScheduler();
            Task t = new Task(delegate { });

            var t2 = t.ContinueWith(delegate {
            }, TaskContinuationOptions.ExecuteSynchronously, s);

            var t3 = t.ContinueWith(delegate {
            }, TaskContinuationOptions.ExecuteSynchronously, s);

            t.Start();

            try
            {
                Assert.IsTrue(t3.Wait(2000), "#0");
                Assert.Fail("#1");
            }
            catch (AggregateException e)
            {
            }

            Assert.AreEqual(TaskStatus.Faulted, t2.Status, "#2");
            Assert.AreEqual(TaskStatus.Faulted, t3.Status, "#3");
        }
        public void ContinuationOnBrokenScheduler()
        {
            var s  = new ExceptionScheduler();
            var t  = new Task(ActionHelper.GetNoopAction());
            var t2 = t.ContinueWith(delegate
            {
                // Empty
            }, TaskContinuationOptions.ExecuteSynchronously, s);

            var t3 = t.ContinueWith(delegate
            {
                // Empty
            }, TaskContinuationOptions.ExecuteSynchronously, s);

            t.Start();

            try
            {
                Assert.IsTrue(t3.Wait(2000), "#0");
                Assert.Fail("#1");
            }
            catch (AggregateException e)
            {
                Theraot.No.Op(e);
            }

            Assert.AreEqual(TaskStatus.Faulted, t2.Status, "#2");
            Assert.AreEqual(TaskStatus.Faulted, t3.Status, "#3");
        }
示例#3
0
		public void ContinuationOnBrokenScheduler ()
		{
			var s = new ExceptionScheduler ();
			Task t = new Task(delegate {});

			var t2 = t.ContinueWith (delegate {
			}, TaskContinuationOptions.ExecuteSynchronously, s);

			var t3 = t.ContinueWith (delegate {
			}, TaskContinuationOptions.ExecuteSynchronously, s);

			t.Start ();

			try {
				Assert.IsTrue (t3.Wait (2000), "#0");
				Assert.Fail ("#1");
			} catch (AggregateException e) {
			}

			Assert.AreEqual (TaskStatus.Faulted, t2.Status, "#2");
			Assert.AreEqual (TaskStatus.Faulted, t3.Status, "#3");
		}