public void ThrowIfDisposed()
        {
            // arrange
            var worker = new EventLoopWorker();

            // act
            worker.Dispose();

            // assert
            Assert.That(() => worker.Schedule(() => { }), Throws.Nothing);
        }
        public void ThrowIfDisposed()
        {
            // arrange
            var worker = new EventLoopWorker();

            // act
            worker.Dispose();

            // assert
            Assert.That(() => worker.Schedule(() => { }), Throws.Nothing);
        }
        public void ProcessesCallbacks()
        {
            // arrange
            var worker = new EventLoopWorker();
            var workDone = new ManualResetEvent(false);
            workDone.Reset();

            // act
            worker.Schedule(() => workDone.Set());

            // assert
            Assert.That(workDone.WaitOne(TimeSpan.FromMilliseconds(100)), Is.True, "Exepcted work to be done within 100ms");

            // dispose stuff
            worker.Dispose();
            workDone.Dispose();
        }
        public void ProcessesCallbacks()
        {
            // arrange
            var worker   = new EventLoopWorker();
            var workDone = new ManualResetEvent(false);

            workDone.Reset();

            // act
            worker.Schedule(() => workDone.Set());

            // assert
            Assert.That(workDone.WaitOne(TimeSpan.FromMilliseconds(100)), Is.True, "Exepcted work to be done within 100ms");

            // dispose stuff
            worker.Dispose();
            workDone.Dispose();
        }