ConvertedActivity ConvertSingleActivityToContinuation( SingleActivity singleActivity, Job parent, ExceptionFilter[] inheritedExceptionFilters) { var job = new Job(Guid.NewGuid(), singleActivity.Type, singleActivity.Name, singleActivity.Arguments, _now(), rootId: parent.RootId, parentId: parent.Id, status: JobStatus.Created, exceptionFilters: inheritedExceptionFilters.Concat(singleActivity.ExceptionFilters).ToArray()); var jobs = new List <Job>(new[] { job }); var continuation = new Continuation { Id = job.Id, Type = ContinuationType.Single, ContinueAfterHandlingFailure = singleActivity.CanContinueAfterHandlingFailure }; var onNext = ConvertCore(singleActivity.Next, parent, inheritedExceptionFilters); continuation.Next = onNext.Continuation; jobs.AddRange(onNext.Jobs); var onFailed = ConvertCore(singleActivity.OnFailed, parent, inheritedExceptionFilters); continuation.OnAllFailed = onFailed.Continuation; jobs.AddRange(onFailed.Jobs); return(new ConvertedActivity(continuation, jobs.AsEnumerable())); }
ConvertedActivity ConvertSingleActivityToContinuation( SingleActivity singleActivity, Job parent, ExceptionFilter[] inheritedExceptionFilters) { var job = new Job(Guid.NewGuid(), singleActivity.Type, singleActivity.Name, singleActivity.Arguments, _now(), rootId: parent.RootId, parentId: parent.Id, status: JobStatus.Created, exceptionFilters: inheritedExceptionFilters.Concat(singleActivity.ExceptionFilters).ToArray()); var jobs = new List<Job>(new[] {job}); var continuation = new Continuation { Id = job.Id, Type = ContinuationType.Single, ContinueAfterHandlingFailure = singleActivity.CanContinueAfterHandlingFailure }; var onNext = ConvertCore(singleActivity.Next, parent, inheritedExceptionFilters); continuation.Next = onNext.Continuation; jobs.AddRange(onNext.Jobs); var onFailed = ConvertCore(singleActivity.OnFailed, parent, inheritedExceptionFilters); continuation.OnAllFailed = onFailed.Continuation; jobs.AddRange(onFailed.Jobs); var onCancel = ConvertCore(singleActivity.OnCancel, parent, inheritedExceptionFilters); if (onCancel.Continuation != null) onCancel.Continuation.CompensateForCancellation = true; continuation.OnCancelled = onCancel.Continuation; jobs.AddRange(onCancel.Jobs); return new ConvertedActivity(continuation, jobs.AsEnumerable()); }
public WaitingForChildrenTransitionFacts() { _job = _world.NewJob.In(JobStatus.Running); _activity = Activity.Run<Test>(t => t.Run()); _converted = new ConvertedActivity(new Continuation(), new[] {(Job) _world.NewJob}); }
public WaitingForChildrenTransitionFacts() { _job = _world.NewJob.In(JobStatus.Running); _activity = Activity.Run <Test>(t => t.Run()); _converted = new ConvertedActivity(new Continuation(), new[] { (Job)_world.NewJob }); }