public static Dictionary <string, string> getParamDictionary(this M_testCaseSteps mtc)
        {
            XElement xe = XElement.Parse(mtc.stepXML);

            var pbs = xe.ParamDictionary();


            var ppbs = xe.Descendants();

            string[] keys = new string[pbs.Count];

            pbs.Keys.CopyTo(keys, 0);

            foreach (var key in keys)
            {
                foreach (var ppb in ppbs)
                {
                    if (key == (string)ppb.Attribute("name"))
                    {
                        pbs[key] = (string)ppb.Attribute("value");
                        break;
                    }
                }
            }

            return(pbs);
        }
Beispiel #2
0
        /// <summary>
        /// 通过stepName获得StepXml(非属性节点,而是真实的)
        /// </summary>
        /// <param name="stepName"></param>
        /// <returns></returns>
        public static XElement getUserStepRealXml(string stepName)
        {
            int stepID = Convert.ToInt32(stepName.Substring(9));
            //这里是用户控件初始化
            QCTESTEntities  QC_DB = new QCTESTEntities();
            M_testCaseSteps mtcs  = QC_DB.M_testCaseSteps.Where(t => t.ID == stepID).First();

            return(XElement.Parse(mtcs.stepXML));
        }
Beispiel #3
0
        /// <summary>
        /// 获取UserStep的参数列表
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static XElement getUserStepParam(string name)
        {
            //if (!isUserStep(name)) return;//是否有必要?

            int stepID = Convert.ToInt32(name.Substring(9));
            //这里是用户控件初始化
            QCTESTEntities  QC_DB = new QCTESTEntities();
            M_testCaseSteps mtcs  = QC_DB.M_testCaseSteps.Where(t => t.ID == stepID).First();
            var             xe    = XElement.Parse(mtcs.paramXML);

            xe.SetAttributeValue("name", "userstep_" + mtcs.ID);
            xe.SetAttributeValue("desc", mtcs.name);

            //mtcs.paramXML.SetAttributeValue("name", name);
            return(xe);
        }