public XModuleAttribute SetupAttributes(XModule mainModule, HtmlElement iframe) { XModuleAttribute iframeAttribute = mainModule.CreateModuleAttribute(); iframeAttribute.Name = iframe.TagName; iframeAttribute.DefaultActionMode = XTestStepActionMode.Select; iframeAttribute.Cardinality = "0-1"; iframeAttribute.BusinessType = "HtmlFrame"; AddBusinessParam(iframeAttribute.CreateConfigurationParam(), "Engine", "Html"); AddBusinessParam(iframeAttribute.CreateConfigurationParam(), "BusinessAssociation", "Descendants"); AddBusinessParam(iframeAttribute.CreateTechnicalIDParam(), "Id", iframe.Id); AddBusinessParam(iframeAttribute.CreateTechnicalIDParam(), "Tag", iframe.TagName); var htmlDocumentAttr = iframeAttribute.CreateModuleAttribute(); htmlDocumentAttr.Name = "HtmlDocument"; htmlDocumentAttr.BusinessType = "HtmlDocument"; htmlDocumentAttr.Cardinality = "0-1"; htmlDocumentAttr.DefaultActionMode = XTestStepActionMode.Select; AddBusinessParam(htmlDocumentAttr.CreateConfigurationParam(), "BusinessAssociation", "Descendants"); AddBusinessParam(htmlDocumentAttr.CreateConfigurationParam(), "Engine", "Html"); return(htmlDocumentAttr); }
public void SetupCellAttributes(XModuleAttribute attribute, HtmlElement table) { attribute.Name = "<Cell>"; attribute.DefaultDataType = ModuleAttributeDataType.String; attribute.Cardinality = "0-N"; attribute.BusinessType = "Cell"; attribute.DefaultActionMode = XTestStepActionMode.Verify; AddBusinessParam(attribute.CreateConfigurationParam(), "Engine", "Html"); AddBusinessParam(attribute.CreateConfigurationParam(), "BusinessAssociation", "Cells"); AddBusinessParam(attribute.CreateConfigurationParam(), "ExplicitName", "#1;#<n>;#last"); }
private void BuildModuleAttribute(XModuleAttribute attribute, string name, Type type, int currentDepth, bool isParameter, XTestStepActionMode defaultMode = XTestStepActionMode.Input) { attribute.Name = name; if (isParameter) { var paramParam = attribute.CreateConfigurationParam(); paramParam.Name = "Parameter"; paramParam.Value = "True"; } var nameParam = attribute.CreateConfigurationParam(); nameParam.Name = "Name"; nameParam.Value = attribute.Name; if (type.IsSimple()) //This is a simple type { if (IsNumericType(type)) { attribute.DefaultDataType = ModuleAttributeDataType.Numeric; } else if (type == typeof(DateTime)) { attribute.DefaultDataType = ModuleAttributeDataType.Date; } else if (type == typeof(bool)) { attribute.DefaultDataType = ModuleAttributeDataType.Boolean; attribute.ValueRange = "true;false"; } else if (type.IsEnum) { attribute.DefaultDataType = ModuleAttributeDataType.String; attribute.ValueRange = Enum.GetNames(type).Aggregate((x, y) => $"{x};{y}"); } else { attribute.DefaultDataType = ModuleAttributeDataType.String; } attribute.DefaultActionMode = defaultMode; } else //class { attribute.DefaultActionMode = XTestStepActionMode.Select; var structureModules = CreateClassStructure(attribute, type, defaultMode, currentDepth, isParameter).ToArray(); } }
public static void AddXParamToModuleAttribute(this XModuleAttribute moduleAttribute, string name, string value, ParamTypeE xParamType) { XParam newXParam = moduleAttribute.CreateConfigurationParam(); newXParam.Name = name; newXParam.Value = value; newXParam.ParamType = xParamType; }