public void TestHardAbort()
        {
            using (WaitAndContinueWorker work = new WaitAndContinueWorker())
            {
                work.OnError += delegate(object o, ErrorEventArgs e) { throw new Exception("Failed.", e.GetException()); };

                SampleWork item = new SampleWork();
                item.SleepForever = true;
                work.AddWork(item);

                item.Ready.Set();
                Assert.IsTrue(item.Sleeping.WaitOne(1000, false));
                work.Abort();

                Assert.IsFalse(item.Completed);
                Assert.IsTrue(item.Disposed);
            }
        }
        public void TestAbortWork()
        {
            using (WaitAndContinueWorker work = new WaitAndContinueWorker())
            {
                work.OnError += delegate(object o, ErrorEventArgs e) { throw new Exception("Failed.", e.GetException()); };

                SampleWork item = new SampleWork();
                work.AddWork(item);

                Assert.IsFalse(work.IsEmpty);
                work.Abort();

                Assert.IsFalse(item.Completed);
                Assert.IsTrue(item.Disposed);
            }
        }