public void Input_of_lambda_function_can_be_customized() { var workflow = new Mock <IWorkflow>(); const string workflowInput = "actvity"; workflow.SetupGet(w => w.WorkflowHistoryEvents).Returns(new WorkflowHistoryEvents(_builder.WorkflowStartedGraph(workflowInput))); var lambdaItem = new LambdaItem(_lambdaIdentity, workflow.Object); lambdaItem.WithInput(i => "CustomInput"); var decisions = lambdaItem.ScheduleDecisions(); var swfDecision = decisions.Single().SwfDecision(); Assert.That(swfDecision.ScheduleLambdaFunctionDecisionAttributes.Input, Is.EqualTo("\"CustomInput\"")); }
public void Does_not_put_non_string_in_quotes() { var workflow = new Mock <IWorkflow>(); const string workflowInput = "actvity"; workflow.SetupGet(w => w.WorkflowHistoryEvents).Returns(new WorkflowHistoryEvents(_builder.WorkflowStartedGraph(workflowInput))); var lambdaItem = new LambdaItem(_lambdaIdentity, workflow.Object); lambdaItem.WithInput(i => 10); var decisions = lambdaItem.ScheduleDecisions(); var swfDecision = decisions.Single().SwfDecision(); Assert.That(swfDecision.ScheduleLambdaFunctionDecisionAttributes.Input, Is.EqualTo("10")); }
public void Invalid_argument_tests() { var lambdaItem = new LambdaItem(_lambdaIdentity, Mock.Of <IWorkflow>()); Assert.Throws <ArgumentNullException>(() => lambdaItem.WithInput(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.WithTimeout(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.OnCompletion(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.OnFailure(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.OnTimedout(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.OnSchedulingFailed(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.OnStartFailed(null)); Assert.Throws <ArgumentException>(() => lambdaItem.AfterActivity(null, "1.0")); Assert.Throws <ArgumentException>(() => lambdaItem.AfterActivity("name", null)); Assert.Throws <ArgumentException>(() => lambdaItem.AfterTimer(null)); Assert.Throws <ArgumentException>(() => lambdaItem.AfterLambda(null)); Assert.Throws <ArgumentException>(() => lambdaItem.AfterChildWorkflow(null, "ver")); Assert.Throws <ArgumentException>(() => lambdaItem.AfterChildWorkflow("name", null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.When(null)); Assert.Throws <ArgumentNullException>(() => lambdaItem.When(null, _ => WorkflowAction.Empty)); Assert.Throws <ArgumentNullException>(() => lambdaItem.When(_ => true, null)); }