Ejemplo n.º 1
0
        public void RunShouldExecuteTasksInOrder()
        {
            TaskRunner runner = new TaskRunner();

            var t1 = new TaskOne();
            var t2 = new TaskOne();
            var t3 = new TaskTwo();

            runner.Add(t1);
            runner.Add(t2);
            runner.Add(t3);

            runner.Run();

            Assert.That(t1.ExecutedAt, Is.LessThan(t2.ExecutedAt));
            Assert.That(t2.ExecutedAt, Is.LessThan(t3.ExecutedAt));
        }
Ejemplo n.º 2
0
        public static ITaskRunner LoadViaConfigurationSection(Section section)
        {
            if (section == null)
            {
                throw Error.ArgumentNull("section");
            }

            var runner = new TaskRunner();

            for (int i = 0; i < section.Tasks.Count; i++)
            {
                Element taskElement = section.Tasks[i];

                runner.Add((ITask) Ioc.Get(taskElement.Type));
            }

            return runner;
        }