Ejemplo n.º 1
0
        public void MakeDecision_UnhandledDecisionTypeTest([Frozen] IDecider decider,
                                                           [Frozen] RespondDecisionTaskCompletedRequest respondDecisionTask)
        {
            _processor = new SDK.Workflow.WorkflowEventsProcessor(_decisionTask, _workflowBase, _pollforDecisionTaskRequest, _amazonSwf);

            var decisionContext = new WorkflowDecisionContext()
            {
                DecisionType = EventType.LambdaFunctionTimedOut
            };

            Assert.Throws <InvalidOperationException>(() => _processor.MakeDecision(decider, decisionContext));
        }
Ejemplo n.º 2
0
        public void MakeDecision_WorkflowExecutionStartedTest([Frozen] IDecider decider,
                                                              [Frozen] RespondDecisionTaskCompletedRequest respondDecisionTask)
        {
            _processor = new SDK.Workflow.WorkflowEventsProcessor(_decisionTask, _workflowBase, _pollforDecisionTaskRequest, _amazonSwf);

            var decisionContext = new WorkflowDecisionContext()
            {
                DecisionType = EventType.WorkflowExecutionStarted
            };

            decider.OnWorkflowExecutionStarted(decisionContext).Returns(info => respondDecisionTask);

            _decisionCompletedRequest = _processor.MakeDecision(decider, decisionContext);
            AssertObjectEquals.PropertyValuesAreEqual(_decisionCompletedRequest.Decisions.First(), respondDecisionTask.Decisions.First());
        }
Ejemplo n.º 3
0
        public void MakeDecision_NullDeciderTest([Frozen] IDecider decider,
                                                 [Frozen] RespondDecisionTaskCompletedRequest respondDecisionTask)
        {
            _processor = new SDK.Workflow.WorkflowEventsProcessor(_decisionTask, _workflowBase, _pollforDecisionTaskRequest, _amazonSwf);

            var decisionContext = new WorkflowDecisionContext()
            {
                DecisionType = EventType.WorkflowExecutionStarted
            };

            _decisionCompletedRequest = _processor.MakeDecision(null, decisionContext);

            var decision = _decisionCompletedRequest.Decisions.First();

            Assert.NotNull(decision);
            Assert.Equal(DecisionType.FailWorkflowExecution, decision.DecisionType);
            Assert.NotNull(decision.FailWorkflowExecutionDecisionAttributes);
            Assert.Equal("Decider not found.", decision.FailWorkflowExecutionDecisionAttributes.Reason);
        }