Beispiel #1
0
        static void Main(string[] args)
        {
            //program for quick tests
            MsTask te = new MsTask();

            te.Info = "E";
            MsTask td = new MsTask();

            td.Info = "D";
            MsTask tc = new MsTask(new List <MsTask> {
                te
            });

            tc.Info = "C";
            MsTask tb = new MsTask(new List <MsTask> {
                td, te
            });

            tb.Info = "B";
            MsTask ta = new MsTask(new List <MsTask> {
                tb, tc
            });

            ta.Info = "A";

            var r = new MsTaskRunEngine(ta);

            r.BuildStack(r.TaskToRun);
            foreach (var t in r.stackTasks)
            {
                Console.WriteLine(t.Info);
            }
            Console.Read();
        }
Beispiel #2
0
        public void EngineRunTaskWithoutDependencies()
        {
            MsTask td = new MsTask();

            td.Info = "D";
            MsTaskRunEngine r = new MsTaskRunEngine(td);

            r.Run();
            Assert.IsTrue(td.MsTaskState);
        }
Beispiel #3
0
        public void EngineRunTaskWithSingleDependency()
        {
            MsTask te = new MsTask();

            te.Info = "E";
            MsTask tc = new MsTask(new List <MsTask> {
                te
            });

            tc.Info = "C";
            MsTaskRunEngine r = new MsTaskRunEngine(tc);

            r.Run();
            Assert.IsTrue(tc.MsTaskState);
            Assert.IsTrue(te.MsTaskState);
            Assert.IsTrue(r.RunEngineLog[0].Info == "E");
            Assert.IsTrue(r.RunEngineLog[1].Info == "C");
        }
Beispiel #4
0
        public void EngineRunTaskWithMultipleDependenciesMultipleLevelsDeep()
        {
            MsTask te = new MsTask();

            te.Info = "E";
            MsTask td = new MsTask();

            td.Info = "D";
            MsTask tc = new MsTask(new List <MsTask> {
                te
            });

            tc.Info = "C";
            MsTask tb = new MsTask(new List <MsTask> {
                td, te
            });

            tb.Info = "B";
            MsTask ta = new MsTask(new List <MsTask> {
                tb, tc
            });

            ta.Info = "A";
            MsTaskRunEngine r = new MsTaskRunEngine(ta);

            r.Run();
            Assert.IsTrue(ta.MsTaskState);
            Assert.IsTrue(tb.MsTaskState);
            Assert.IsTrue(tc.MsTaskState);
            Assert.IsTrue(td.MsTaskState);
            Assert.IsTrue(te.MsTaskState);
            Assert.IsTrue(r.RunEngineLog[0].Info == "E");
            Assert.IsTrue(r.RunEngineLog[1].Info == "C");
            Assert.IsTrue(r.RunEngineLog[2].Info == "E");
            Assert.IsTrue(r.RunEngineLog[3].Info == "D");
            Assert.IsTrue(r.RunEngineLog[4].Info == "B");
            Assert.IsTrue(r.RunEngineLog[5].Info == "A");
        }
Beispiel #5
0
        public void EngineRunTaskWithMultipleDependenciesOneLevelDeep()
        {
            MsTask te = new MsTask();

            te.Info = "E";
            MsTask td = new MsTask();

            td.Info = "D";
            MsTask tb = new MsTask(new List <MsTask> {
                td, te
            });

            tb.Info = "B";
            MsTaskRunEngine r = new MsTaskRunEngine(tb);

            r.Run();
            Assert.IsTrue(tb.MsTaskState);
            Assert.IsTrue(td.MsTaskState);
            Assert.IsTrue(te.MsTaskState);
            Assert.IsTrue(r.RunEngineLog[0].Info == "E");
            Assert.IsTrue(r.RunEngineLog[1].Info == "D");
            Assert.IsTrue(r.RunEngineLog[2].Info == "B");
        }
Beispiel #6
0
        public void TasksOfSameTypeShouldExecuteOnce()
        {
            MsTaskRunEngine r = new MsTaskRunEngine(new MsTask());

            Assert.IsInstanceOfType(r, typeof(MsTaskRunEngine));
        }
Beispiel #7
0
        public void CreateObjectTypeTaskRunEngine()
        {
            MsTaskRunEngine r = new MsTaskRunEngine(new MsTask());

            Assert.IsInstanceOfType(r, typeof(MsTaskRunEngine));
        }