Beispiel #1
0
        public void InitializeEmptyExecutionQueue()
        {
            ITaskExecutor taskQueue = new ExecutionQueue("EQ");

            taskQueue.Start();

            if (!taskQueue.IsStarted)
            {
                throw new InvalidOperationException();
            }

            taskQueue.Stop(true);

            if (taskQueue.IsStarted)
            {
                throw new InvalidOperationException();
            }
        }
Beispiel #2
0
        public void InitializeExecuteActions()
        {
            ITaskExecutor taskQueue = new ExecutionQueue();
            int           counter   = 0;

            taskQueue.Start();
            taskQueue.Add((e) => { counter++; });
            taskQueue.Add((e) => { if (counter == 1)
                                   {
                                       counter++;
                                   }
                          });
            taskQueue.Add((e) => { if (counter == 2)
                                   {
                                       counter++;
                                   }
                          });

            // complete all tasks:
            taskQueue.Stop(true);

            Assert.AreEqual(3, counter, "3 Tasks should perform their job!");
        }