public static Workflow AddExpressionToWorkflowVariable(this Workflow wf, string argumentName, string expressionString, bool isTemplate = false) { var destination = wf.Variables.FirstOrDefault(v => v.Name == argumentName); if (destination == null) { throw new ArgumentException(String.Format("No matching variable name for workflow. Workflow='{0}' Argument='{1}'", wf.Name ?? "<unnamed>", argumentName ?? "<unnamed>")); } ActivityTestHelper.AddExpressionToArgument(wf, wf.Cast <WfActivity>(), destination, expressionString, isTemplate); return(wf); }
private static ActivityArgument CreateActivityArg <T>(Workflow wf, string name, string expression, EntityType conformsToType) where T : IEntity, new() { var myVar = new T(); myVar.SetField("name", name); if (conformsToType != null) { var typedVar = myVar.As <TypedArgument>(); typedVar.ConformsToType = conformsToType; } var myVarAs = myVar.As <ActivityArgument>(); if (expression != null) { ActivityTestHelper.AddExpressionToArgument(wf, wf.Cast <WfActivity>(), myVarAs, expression, false); } return(myVarAs); }