Beispiel #1
0
        /// <summary>
        /// 根据enName获取单元测试实例.
        /// </summary>
        /// <param name="enName"></param>
        /// <returns></returns>
        public static BP.UnitTesting.TestBase GetTestEntity(string enName)
        {
            ArrayList al = null;

            al = BP.En.ClassFactory.GetObjects("BP.UnitTesting.TestBase");
            foreach (Object obj in al)
            {
                BP.UnitTesting.TestBase en = null;
                try
                {
                    en = obj as BP.UnitTesting.TestBase;
                    if (en == null)
                    {
                        continue;
                    }
                    string s = en.Title;
                    if (en == null)
                    {
                        continue;
                    }
                }
                catch
                {
                    continue;
                }

                if (en.ToString() == enName)
                {
                    return(en);
                }
            }

            throw new Exception("err@单元测试名称拼写错误或者不存在[" + enName + "]");
        }
Beispiel #2
0
        /// <summary>
        /// 单元测试
        /// </summary>
        /// <returns></returns>
        public string UnitTesting_Init()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("No");
            dt.Columns.Add("Name");
            dt.Columns.Add("Note");

            ArrayList al = null;

            al = BP.En.ClassFactory.GetObjects("BP.UnitTesting.TestBase");
            foreach (Object obj in al)
            {
                BP.UnitTesting.TestBase en = null;
                try
                {
                    en = obj as BP.UnitTesting.TestBase;
                    if (en == null)
                    {
                        continue;
                    }
                    string s = en.Title;
                    if (en == null)
                    {
                        continue;
                    }
                }
                catch
                {
                    continue;
                }

                if (en.ToString() == null)
                {
                    continue;
                }

                DataRow dr = dt.NewRow();
                dr["No"]   = en.ToString();
                dr["Name"] = en.Title;
                dr["Note"] = en.Note;
                dt.Rows.Add(dr);
            }
            return(BP.Tools.Json.ToJson(dt));
        }