protected override void BuildDataList() { BuildShapeAndTestData(); var decisionActivity = new DsfFlowDecisionActivity(); Dev2DecisionMode mode; ScenarioContext.Current.TryGetValue("mode", out mode); var decisionModels = ScenarioContext.Current.Get<List<Tuple<string, enDecisionType, string, string>>>("decisionModels"); var dds = new Dev2DecisionStack { TheStack = new List<Dev2Decision>(), Mode = mode, TrueArmText = "YES", FalseArmText = "NO" }; foreach(var dm in decisionModels) { var dev2Decision = new Dev2Decision { Col1 = dm.Item1 ?? string.Empty, EvaluationFn = dm.Item2, Col2 = dm.Item3 ?? string.Empty, Col3 = dm.Item4 ?? string.Empty }; dds.AddModelItem(dev2Decision); } string modelData = dds.ToVBPersistableModel(); ScenarioContext.Current.Add("modelData", modelData); decisionActivity.ExpressionText = string.Join("", GlobalConstants.InjectedDecisionHandler, "(\"", modelData, "\",", GlobalConstants.InjectedDecisionDataListVariable, ")"); List<Tuple<string, string>> variableList; ScenarioContext.Current.TryGetValue("variableList", out variableList); if(variableList == null) { variableList = new List<Tuple<string, string>>(); ScenarioContext.Current.Add("variableList", variableList); } var multiAssign = new DsfMultiAssignActivity(); int row = 1; foreach(var variable in variableList) { multiAssign.FieldsCollection.Add(new ActivityDTO(variable.Item1, variable.Item2, row, true)); row++; } FlowDecision x = new FlowDecision(); x.Condition=decisionActivity; TestStartNode = new FlowStep { Action = multiAssign, Next = x }; ScenarioContext.Current.Add("activity", decisionActivity); }
public static void InjectExpression(Dev2DecisionStack ds, ModelProperty activityExpression) { if(ds == null) return; string modelData = ds.ToVBPersistableModel(); string expressionToInject = String.Join("", GlobalConstants.InjectedDecisionHandler, "(\"", modelData, "\",", GlobalConstants.InjectedDecisionDataListVariable, ")"); if(activityExpression != null) { activityExpression.SetValue(expressionToInject); } }