コード例 #1
0
        public void EnsureAScheduledRunOnceRuns()
        {
            var schedule = new ScheduleOneOff {
                ScheduleSpecificTime = DateTime.UtcNow.AddMilliseconds(5000)
            };

            schedule.Save();

            var tos = new WfTriggerOnSchedule
            {
                Name           = "EnsureAScheduledRunOnceRuns_Job " + DateTime.Now,
                TriggerEnabled = true,
                WorkflowToRun  = CreateLoggingWorkflow("EnsureAScheduledRunOnceRuns")
            };

            tos.ScheduleForTrigger.Add(schedule.As <Schedule>());
            tos.Save();

            ToDelete.Add(tos.Id);
            ToDelete.Add(tos.WorkflowToRun.Id);
            ToDelete.Add(tos.ScheduleForTrigger.First().Id);

            var workflow = WaitForWfRun(tos);

            Assert.AreEqual(1, workflow.RunningInstances.Count(), "Ensure the workflow actually ran once");
        }
コード例 #2
0
        public void TwoTriggersTest_22065()
        {
            var schedule = new ScheduleOneOff
            {
                ScheduleSpecificTime = DateTime.UtcNow.AddMilliseconds(500),
            };

            schedule.Save();

            var tos1 = new WfTriggerOnSchedule
            {
                TriggerEnabled = true,
                WorkflowToRun  = CreateLoggingWorkflow("TwoTriggersTest_22065-1")
            };

            tos1.ScheduleForTrigger.Add(schedule.As <Schedule>());

            tos1.Save();

            ToDelete.Add(tos1.Id);
            ToDelete.Add(tos1.WorkflowToRun.Id);
            ToDelete.Add(tos1.ScheduleForTrigger.First().Id);

            var tos2 = new WfTriggerOnSchedule
            {
                TriggerEnabled = true,
                WorkflowToRun  = CreateLoggingWorkflow("TwoTriggersTest_22065-2")
            };

            tos2.ScheduleForTrigger.Add(schedule.As <Schedule>());

            tos2.Save();

            ToDelete.Add(tos2.Id);
            ToDelete.Add(tos2.WorkflowToRun.Id);
            ToDelete.Add(tos2.ScheduleForTrigger.First().Id);

            var workflow1 = WaitForWfRun(tos1);
            var workflow2 = WaitForWfRun(tos2);

            Assert.AreEqual(1, workflow1.RunningInstances.Count(), "Ensure the workflow1 actually ran once");
            Assert.AreEqual(1, workflow2.RunningInstances.Count(), "Ensure the workflow2 actually ran once");
        }