示例#1
0
        public void TestRunWithException()
        {
            _exceptionHandled = false;
            AsyncProcessor proc = new AsyncProcessor();

            using ( proc )
            {
                proc.ExceptionHandler = new AsyncExceptionHandler(ExceptionHandler);
                proc.QueueJob(new SleepJob(200));
                AsyncProcessor proc1 = new AsyncProcessor();
                AsyncProcessor proc2 = new AsyncProcessor();
                AsyncProcessor proc3 = new AsyncProcessor();
                AsyncProcessor proc4 = new AsyncProcessor();
                AsyncProcessor proc5 = new AsyncProcessor();
                proc1.QueueJob(new ExceptionJobRunner(proc));
                proc2.QueueJob(new ExceptionJobRunner(proc));
                proc3.QueueJob(new ExceptionJobRunner(proc));
                proc4.QueueJob(new ExceptionJobRunner(proc));
                proc5.QueueJob(new ExceptionJobRunner(proc));
                try
                {
                    proc.RunUniqueJob(new ExceptionJob());
                }
                catch (Exception e)
                {
                    e = Utils.GetMostInnerException(e);
                    if (!(e is StrangeJobException))
                    {
                        throw new Exception(e.Message);
                    }
                }
                proc1.Dispose();
                proc2.Dispose();
                proc3.Dispose();
                proc4.Dispose();
                proc5.Dispose();
            }
        }
示例#2
0
 [TearDown] public void TearDown()
 {
     _core.Dispose();
     _resourceAP.Dispose();
 }