public void ReturnsTrueForContinuableContinuationsWithoutAnyFailureHandlers()
        {
            var continuation = new Continuation {
                Status = JobStatus.Poisoned, ContinueAfterHandlingFailure = true
            };

            var result = continuation.CanContinue();

            Assert.True(result);
        }
        public void ReturnsFalseIfAnyChildContinuationIsNotContinuable()
        {
            var continuation = new Continuation
            {
                Status   = JobStatus.Created,
                Children = new[] { new Continuation {
                                       Status = JobStatus.Poisoned
                                   } }
            };

            var result = continuation.CanContinue();

            Assert.False(result);
        }
        public void ReturnsTrueIfAllContinuationsInGroupAreCompleted()
        {
            var continuation = new Continuation
            {
                Status   = JobStatus.Created,
                Children = new[] { new Continuation {
                                       Status = JobStatus.Completed
                                   } }
            };

            var result = continuation.CanContinue();

            Assert.True(result);
        }
        public void ReturnsFalseIfAnyFailureHandlerIsFailed()
        {
            var continuation = new Continuation
            {
                Status = JobStatus.Poisoned,
                ContinueAfterHandlingFailure = true,
                OnAllFailed = new Continuation {
                    Status = JobStatus.Poisoned
                }
            };

            var result = continuation.CanContinue();

            Assert.False(result);
        }
        public void ReturnsTrueIfAllFailureHandlersAreCompleted()
        {
            var continuation = new Continuation
            {
                Status = JobStatus.Poisoned,
                ContinueAfterHandlingFailure = true,
                OnAnyFailed = new Continuation {
                    Status = JobStatus.Completed
                },
                OnAllFailed = new Continuation {
                    Status = JobStatus.Completed
                }
            };

            var result = continuation.CanContinue();

            Assert.True(result);
        }
        public void ReturnsTrueForGroupWithFailedChildrenButSuccessfulFailureHandlers()
        {
            var continuation = new Continuation
            {
                Status   = JobStatus.Created,
                Children = new[] { new Continuation {
                                       Status = JobStatus.Poisoned
                                   } },
                ContinueAfterHandlingFailure = true,
                OnAnyFailed = new Continuation {
                    Status = JobStatus.Completed
                },
                OnAllFailed = new Continuation {
                    Status = JobStatus.Completed
                }
            };

            var result = continuation.CanContinue();

            Assert.True(result);
        }