示例#1
0
        public void Continue_the_execution_when_any_of_waiting_signal_is_received()
        {
            var graph = _graphBuilder.LambdaCompletedEventGraph(_sendForApprovalId, "input", "result");

            _builder.AddProcessedEvents(graph);
            _builder.AddProcessedEvents(_graphBuilder.WaitForSignalEvent(_sendForApprovalId, graph.First().EventId, new[] { "Approved", "Rejected" }, SignalWaitType.Any));
            var s = _graphBuilder.WorkflowSignaledEvent("Approved", "");

            _builder.AddNewEvents(s);


            var workflow  = new ExpenseWorkflowToSendEmail();
            var decisions = workflow.Decisions(_builder.Result());

            Assert.That(decisions, Is.EqualTo(new WorkflowDecision[]
            {
                new ScheduleLambdaDecision(Identity.Lambda("SendEmail").ScheduleId(), "input"),
                new WorkflowItemSignalledDecision(_sendForApprovalId, graph.First().EventId, "Approved", s.EventId)
            }));
        }
示例#2
0
        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));
        }