public void Returns_swf_decision_to_record_the_marker() { var id = Identity.Lambda("a").ScheduleId(); var d = new WaitForSignalData() { ScheduleId = id, TriggerEventId = 10, WaitType = SignalWaitType.Any, NextAction = SignalNextAction.Continue, SignalNames = new[] { "Signal" } }; var decision = new WaitForSignalsDecision(d); var swfDecision = decision.SwfDecision(); Assert.That(swfDecision.DecisionType, Is.EqualTo(DecisionType.RecordMarker)); var attr = swfDecision.RecordMarkerDecisionAttributes; Assert.That(attr.MarkerName, Is.EqualTo("WorkflowItemWaitForSignals_Guflow_Internal_Marker")); var data = attr.Details.AsDynamic(); Assert.That((string)data.ScheduleId, Is.EqualTo(id.ToString())); Assert.That((long)data.TriggerEventId, Is.EqualTo(10)); Assert.That(data.SignalNames.ToObject <string[]>(), Is.EqualTo(new[] { "Signal" })); Assert.That((SignalWaitType)data.WaitType, Is.EqualTo(SignalWaitType.Any)); Assert.That((SignalNextAction)data.NextAction, Is.EqualTo(SignalNextAction.Continue)); }
public void Returns_wait_for_signals_decision() { var graph = _graphBuilder.LambdaCompletedEventGraph(_sendForApprovalId, "input", "result"); _builder.AddNewEvents(graph); var workflow = new ExpenseWorkflowToSendEmail(); var decisions = workflow.Decisions(_builder.Result()); var signalData = new WaitForSignalData { ScheduleId = _sendForApprovalId, TriggerEventId = graph.First().EventId }; Assert.That(decisions, Is.EqualTo(new[] { new WaitForSignalsDecision(signalData) })); var attr = decisions.First().SwfDecision().RecordMarkerDecisionAttributes; var data = attr.Details.AsDynamic(); Assert.That(data.SignalNames.ToObject <string[]>(), Is.EqualTo(new[] { "Approved", "Rejected" })); Assert.That((SignalWaitType)data.WaitType, Is.EqualTo(SignalWaitType.Any)); Assert.That((SignalNextAction)data.NextAction, Is.EqualTo(SignalNextAction.Continue)); }
public void Ignore_the_second_signal_when_two_similar_signals_are_received_along_with_wait_for_signal_decision() { var graph = _graphBuilder.LambdaCompletedEventGraph(_confirmEmailId, "input", "result"); _builder.AddNewEvents(graph); var s = _graphBuilder.WorkflowSignaledEvent("Confirmed", ""); _builder.AddNewEvents(s); _builder.AddNewEvents(_graphBuilder.WorkflowSignaledEvent("Confirmed", "")); var workflow = new UserActivateWorkflow(); var decision = workflow.Decisions(_builder.Result()); var d = new WaitForSignalData() { ScheduleId = _confirmEmailId, TriggerEventId = graph.First().EventId }; Assert.That(decision, Is.EqualTo(new WorkflowDecision[] { new WaitForSignalsDecision(d), new ScheduleLambdaDecision(Identity.Lambda("ActivateUser").ScheduleId(), "input"), new WorkflowItemSignalledDecision(_confirmEmailId, graph.First().EventId, "Confirmed", s.EventId) })); }