Example #1
0
        public void Invalid_arguments()
        {
            var childWorkflowItem = new ChildWorkflowItem(_identity, _workflow.Object);

            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnCompletion(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnFailure(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnCancelled(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnTerminated(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnTimedout(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnStartFailed(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithInput(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithChildPolicy(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithLambdaRole(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.OnTaskList(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithPriority(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithTimeouts(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.WithTags(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.When(null));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.When(null, _ => WorkflowAction.Empty));
            Assert.Throws <ArgumentNullException>(() => childWorkflowItem.When(_ => true, null));

            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterTimer(null));
            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterActivity(null, "v"));
            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterActivity("n", null));
            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterLambda(null));
            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterChildWorkflow(null, "1.0"));
            Assert.Throws <ArgumentException>(() => childWorkflowItem.AfterChildWorkflow("n", null));
        }
Example #2
0
        public void Input_can_be_customized()
        {
            var          workflow      = new Mock <IWorkflow>();
            const string workflowInput = "\"input\"";

            workflow.SetupGet(w => w.WorkflowHistoryEvents).Returns(new WorkflowHistoryEvents(_eventGraphBuilder.WorkflowStartedGraph(workflowInput)));
            var item = new ChildWorkflowItem(_identity, workflow.Object);

            item.WithInput(_ => new{ Id = 1 });

            var decisions   = item.ScheduleDecisions();
            var swfDecision = decisions.Single().SwfDecision();

            Assert.That(swfDecision.StartChildWorkflowExecutionDecisionAttributes.Input, Is.EqualTo("{\"Id\":1}"));
        }