public void SimpleSyncerJob() {
            var syncer = new Job();
            syncer.Tasks["ab"] = uab;
            syncer.Tasks["ba"] = uba;
            writeA("y");
            syncer.Execute();
            syncer.Execute();
            writeA("y2");
            syncer.Execute();
            writeB("y3");
            syncer.Execute();
            check(@"
ab - S:Pending
ba - S:Pending
ab - S:Executing
ab - copy a.txt to b.txt
ab - S:Success
ba - S:SuccessNotRun
ab - S:Pending
ba - S:Pending
ab - S:SuccessNotRun
ba - S:SuccessNotRun
ab - S:Pending
ba - S:Pending
ab - S:Executing
ab - copy a.txt to b.txt
ab - S:Success
ba - S:SuccessNotRun
ab - S:Pending
ba - S:Pending
ab - S:SuccessNotRun
ba - S:Executing
ba - copy b.txt to a.txt
ba - S:Success
");
        }
Beispiel #2
0
        public void ExplicitOrderOfTasks() {
            var j = new Job();
            j["database"] = DbName;
            var sw = new StringWriter();
            j.Log = TextWriterLogWriter.CreateLog(sw, level: LogLevel.Info, customFormat: "${Message}");
            File.WriteAllText(file, @"
--!options idx=20
select 2 print '2 selected'
");
            File.WriteAllText(file2, @"
--!options idx=10
select 1 print '1 selected'");
            j.Tasks["t1"] = new ScriptFileDbUpdateTask(file);
            j.Tasks["t2"] = new ScriptFileDbUpdateTask(file2);
            j.Execute();
            var result = sw.ToString();
            Console.WriteLine(result);
            Assert.AreEqual(@"finish t2 with Success
finish t1 with Success
", result);
        }
        public void OnceCopyTest() {
            var syncer = new Job();
            uab.RunOnce = true;
            uba.RunOnce = true;
            syncer.Tasks["ab"] = uab;
            syncer.Tasks["ba"] = uba;
            writeA("y");
            syncer.Execute();
            writeA("y2");
            syncer.Execute();
            writeB("y3");
            syncer.Execute();
            check(@"
ab - S:Pending
ba - S:Pending
ab - S:Executing
ab - copy a.txt to b.txt
ab - S:Success
ba - S:SuccessOnce
ab - S:Pending
ba - S:Pending
ab - S:SuccessOnce
ba - S:SuccessOnce
ab - S:Pending
ba - S:Pending
ab - S:SuccessOnce
ba - S:SuccessOnce
");
        }