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)); }
public void Can_override_scheduling_properties_when_workflow_description_is_not_provided() { var item = new ChildWorkflowItem(_identity, _workflow.Object); item.WithChildPolicy(_ => "newchild").WithLambdaRole(_ => "newlambda").OnTaskList(_ => "newtask") .WithPriority(_ => 2).WithTimeouts(_ => new WorkflowTimeouts() { ExecutionStartToCloseTimeout = TimeSpan.FromSeconds(4), TaskStartToCloseTimeout = TimeSpan.FromSeconds(5) }).WithTags(_ => new[] { "hello", "hi" }); var swfDecision = item.ScheduleDecisions().First().SwfDecision(); Assert.That(swfDecision.DecisionType, Is.EqualTo(DecisionType.StartChildWorkflowExecution)); var attr = swfDecision.StartChildWorkflowExecutionDecisionAttributes; Assert.That(attr.WorkflowType.Name, Is.EqualTo(WorkflowName)); Assert.That(attr.WorkflowType.Version, Is.EqualTo(Version)); Assert.That(attr.WorkflowId, Is.EqualTo(_scheduleIdentity.ToString())); Assert.That(attr.Control.As <ScheduleData>().PN, Is.EqualTo(_identity.PositionalName)); Assert.That(attr.ChildPolicy.Value, Is.EqualTo("newchild")); Assert.That(attr.ExecutionStartToCloseTimeout, Is.EqualTo("4")); Assert.That(attr.LambdaRole, Is.EqualTo("newlambda")); Assert.That(attr.TaskList.Name, Is.EqualTo("newtask")); Assert.That(attr.TaskPriority, Is.EqualTo("2")); Assert.That(attr.TaskStartToCloseTimeout, Is.EqualTo("5")); Assert.That(attr.TagList, Is.EqualTo(new[] { "hello", "hi" })); }