public static WorkflowJob GetWorkflowJob(JobId id = null, WhenFailure ifFailure = WhenFailure.ContinueOn, ShareContext share = ShareContext.Parent, int noOfJobs = 0, JobStatus status = JobStatus.Completed, bool longProcess = false) { if (id == null) { id = GetJobId(); } var context = new Mock <IJobContext>(); context.Setup(c => c.ParentJobId).Returns(id); var rtn = new WorkflowJob(id, context.Object, ifFailure, share); for (int i = 0; i < noOfJobs; i++) { rtn.AddJob( longProcess? GetLongRunningJob( TimeSpan.FromMilliseconds(500), null, status) .Object : GetFakeJob(null, status) .Object); } return(rtn); }
public WorkflowJob(JobId id, IJobContext context, WhenFailure onFailure, ShareContext share, IWorkflowHost <IRuntime> host = null) { if (id == default(JobId) || context == default(IJobContext)) { throw new ArgumentNullException("id, context"); } Id = id; Context = context; OnFailure = onFailure; Option = share; _host = host ?? ServiceRepo.Instance.GetServiceOf <IWorkflowHost <SequentialRuntime> >()?.AsHost(); _runner = null; _workflow = new List <IAutomatedJob>(); }
public Builder WithOption(WhenFailure onFailure, ShareContext share) { _failure = onFailure; _share = share; return(this); }