public void CopyAttributesFrom(ValidationUCScriptGenerationParams source) { base.CopyAttributesFrom(source); this.listExps = source.listExps; this.className = source.className; this.functionName = source.functionName; }
public virtual IScriptGenerationParams Clone() { IScriptGenerationParams re; if (this is RanorexValidationUCScriptGenerationParams) { re = new RanorexValidationUCScriptGenerationParams(); ((RanorexValidationUCScriptGenerationParams)re).CopyAttributesFrom(this as RanorexValidationUCScriptGenerationParams); } else if (this is RanorexWaitValidateScriptGenerationParams) { re = new RanorexWaitValidateScriptGenerationParams(); ((RanorexWaitValidateScriptGenerationParams)re).CopyAttributesFrom(this as RanorexWaitValidateScriptGenerationParams); } else if (this is RanorexUCScriptGenerationParams) { re = new RanorexUCScriptGenerationParams(); ((RanorexUCScriptGenerationParams)re).CopyAttributesFrom(this as RanorexUCScriptGenerationParams); } else if (this is RanorexScriptGenerationParams) { re = new RanorexScriptGenerationParams(); ((RanorexUCScriptGenerationParams)re).CopyAttributesFrom(this as RanorexUCScriptGenerationParams); } else if (this is ValidationUCScriptGenerationParams) { re = new ValidationUCScriptGenerationParams(); ((ValidationUCScriptGenerationParams)re).CopyAttributesFrom(this as ValidationUCScriptGenerationParams); } else if (this is WaitValidateScriptGenerationParams) { re = new WaitValidateScriptGenerationParams(); ((WaitValidateScriptGenerationParams)re).CopyAttributesFrom(this as WaitValidateScriptGenerationParams); } else if (this is UserCodeScriptGenerationParams) { re = new UserCodeScriptGenerationParams(); ((UserCodeScriptGenerationParams)re).CopyAttributesFrom(this as UserCodeScriptGenerationParams); } else { re = new ScriptGenerationParams(); ((ScriptGenerationParams)re).CopyAttributesFrom(this as ScriptGenerationParams); } CopyAttributes(re, this); return(re); }
private void DoExpand(SpecScreen screen, string pathToApp, MyLog myLog, List <ClassExpression> allClassesExp) { for (int fi = 0; fi < screen.Scenarios.Count; fi++) { IScenario tempScenario = screen.Scenarios[fi]; if (tempScenario is SpecScenario) { SpecScenario scenario = tempScenario as SpecScenario; List <string> listActionExp = scenario.UserActionsInString; List <Color> colors = scenario.Colors; for (int se = 0; se < listActionExp.Count; se++) { string actionExp = listActionExp[se]; if (actionExp == null) { myLog.Error("NULL at (" + (fi + 1) + "," + (se + 2) + ")"); continue; } SpecNode specNode = screen.ListSpecNodes[se]; ScriptGenerationParams _params = null; AbstractSpecUserAction specUserAction = null; int lastInd = IsValidationUserCode(se, screen.ListValidationUserCode); if (lastInd > se) { specUserAction = new ValidationUserCodeSpecUserAction(); _params = new ValidationUCScriptGenerationParams(); List <string> listExp = new List <string>(); for (int th = se; th <= lastInd; th++) { String tempActionExp = listActionExp[th]; AbstractSpecUserAction temp = handleUserActionExpression( tempActionExp.Trim(), specNode, colors[th], myLog); if (!(temp is ValidationSpecUserAction)) { myLog.Warn("Expression: " + tempActionExp + " must be validation", logger); screen = null; return; } else { if (tempActionExp != null && !tempActionExp.Trim().Equals("")) { listExp.Add(tempActionExp.Trim()); } } } (specUserAction as ValidationUserCodeSpecUserAction).ListExps = listExp; ((ValidationUCScriptGenerationParams)_params).ListExps = listExp; if (screen is TestSpecificationScreen) { ((ValidationUCScriptGenerationParams)_params).ClassExpressions = allClassesExp; } ((ValidationUCScriptGenerationParams)_params).ClassName = AbstractSpecUserAction.GetFolderNameFromScreen(screen) + "_Validation"; ((ValidationUCScriptGenerationParams)_params).FunctionName = "Validate_" + Regex.Replace(specNode.Expression, "[^A-Za-z0-9]", "_"); SetAttributes(scenario, specUserAction, specNode, screen, pathToApp, colors, _params, se, myLog); se = lastInd; } else { string[] listActionsEpx = splitAction(actionExp, AbstractSpecUserAction.AND); foreach (string action in listActionsEpx) { specUserAction = handleUserActionExpression(action.Trim(), specNode, colors[se], myLog); if (specUserAction != null) { if (specUserAction is UserCodeSpecUserAction userCodeExpression) { _params = new UserCodeScriptGenerationParams(); ((UserCodeScriptGenerationParams)_params).MapAliasWithNode = screen.MappingAliasWithNode; if (screen is TestSpecificationScreen testSpecScreen) { ((UserCodeScriptGenerationParams)_params).ClassExpressions = allClassesExp; } } else if (specUserAction is WaitValidateSpecUserAction waitUserAction) { _params = new WaitValidateScriptGenerationParams(); } else { _params = new ScriptGenerationParams(); } SetAttributes(scenario, specUserAction, specNode, screen, pathToApp, colors, _params, se, myLog); } } } } } } }