Exemplo n.º 1
0
        public void ThrowIfDisposed()
        {
            // arrange
            var worker = new EventLoopWorker();

            // act
            worker.Dispose();

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

            // act
            worker.Dispose();

            // assert
            Assert.That(() => worker.Schedule(() => { }), Throws.Nothing);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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();
        }