Ejemplo n.º 1
0
        public void ExecuteTest()
        {
            var sequence = 0;
            var worker   = new WorkerQueue();

            worker.Execute(() => { Assert.AreEqual(0, sequence); Thread.Sleep(10); ++sequence; });
            worker.Execute(() => { Assert.AreEqual(1, sequence); Thread.Sleep(10); ++sequence; });
            worker.Execute(() => { Assert.AreEqual(2, sequence); Thread.Sleep(10); ++sequence; });
            worker.Execute(() => { Assert.AreEqual(3, sequence); Thread.Sleep(10); ++sequence; });
            worker.Execute(() => { Assert.AreEqual(4, sequence); Thread.Sleep(10); ++sequence; });

            Assert.AreEqual(5, sequence);
        }