public MakeDecisionTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", (key, value) => $"{key} - {value}"); WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflowBase = Substitute.For <WorkflowBase>("domain", "workflowName", "version", "taskList", _amazonSwf); var describeWorkflowExecutionRequest = Substitute.For <DescribeWorkflowExecutionRequest>(); describeWorkflowExecutionRequest.Domain = _pollforDecisionTaskRequest.Domain; describeWorkflowExecutionRequest.Execution = _decisionTask.WorkflowExecution; }
public WorkflowTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", (index, value) => $"{value} - {index}"); _executionContext = WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflow = Substitute.For <WorkflowBase>("domain", _defaultWorkflowName, "version", "taskList", _amazonSwf); }
public WorkflowEventsProcessorTests() { _decisionTask = Substitute.For <DecisionTask>(); _decisionTask.WorkflowType = new WorkflowType { Name = "TestWorkflow", Version = "TestVersion" }; _decisionTask.WorkflowExecution = new WorkflowExecution { RunId = "TestRunId", WorkflowId = "" }; var results = new ConcurrentDictionary <int, string>(); results.AddOrUpdate(1, "TestResult", UpdateValueFactory); _executionContext = WorkflowStateSerializer.Serialize(new WorkflowState() { CurrentStepNumber = 1, NumberOfActions = 1, Results = results }); _pollforDecisionTaskRequest = Substitute.For <PollForDecisionTaskRequest>(); _pollforDecisionTaskRequest.Domain = "TestDomain"; _amazonSwf = Substitute.For <IAmazonSimpleWorkflow>(); _workflowBase = Substitute.For <WorkflowBase>("domain", "workflowName", "version", "taskList", _amazonSwf); var describeWorkflowExecutionRequest = Substitute.For <DescribeWorkflowExecutionRequest>(); describeWorkflowExecutionRequest.Domain = _pollforDecisionTaskRequest.Domain; describeWorkflowExecutionRequest.Execution = _decisionTask.WorkflowExecution; //_amazonSwf.DescribeWorkflowExecution(describeWorkflowExecutionRequest) // .ReturnsForAnyArgs( // info => // new DescribeWorkflowExecutionResponse() // { // HttpStatusCode = HttpStatusCode.OK, // WorkflowExecutionDetail = new WorkflowExecutionDetail() {LatestExecutionContext = _executionContext} // }); SDK.Workflow.WorkflowEventsProcessor processor = Substitute.For <SDK.Workflow.WorkflowEventsProcessor>(_decisionTask, _workflowBase, _pollforDecisionTaskRequest, _amazonSwf); processor.GetLastExecContext().ReturnsForAnyArgs(info => WorkflowStateSerializer.Deserialize(_executionContext)); //_workflowEventsIterator = Substitute.For<WorkflowEventsIterator>(_decisionTask, _pollforDecisionTaskRequest, // _amazonSwf); }