Пример #1
0
        /// <summary>
        /// 创建一个新的字符串SID标识值
        /// </summary>
        /// <returns>字符串标识</returns>
        public string CreateNewSID()
        {
            List <char> char_list = new List <char>();

            char_list.AddRange(CommonData.ASCII_Number());
            char_list.AddRange(CommonData.ASCII_LowerEnglish());
            char[] chars      = char_list.ToArray();
            string first_step = RandomData.GetString(chars, 27);
            // 创建几个计算方法, 随机选择一个与 first_step 计算得到新的记录

            EnumInfo enum_info = EnumInfo.AnalysisItem(GetUseCode());

            return(string.Format("{0}-{1}", enum_info.IntValue.ToString(), first_step));
        }
Пример #2
0
        public CaseModel Func_AnalysisItem()
        {
            return(new CaseModel()
            {
                NameSign = @"解析枚举的单个选项",
                ExeEvent = () => {
                    Func <TestEnum, string, int, string, bool> method = (enumItem, name, vint, explain) => {
                        EnumInfo info = EnumInfo.AnalysisItem <TestEnum>(enumItem);
                        if (CheckData.IsObjectNull(info))
                        {
                            return false;
                        }
                        if (!info.Name.Equals(name))
                        {
                            return false;
                        }
                        if (!info.IntValue.Equals(vint))
                        {
                            return false;
                        }
                        if (!info.Explain.Equals(explain))
                        {
                            return false;
                        }
                        return true;
                    };

                    if (!method(TestEnum.Secrecy, @"Secrecy", 0, @"保密"))
                    {
                        return false;
                    }
                    if (!method(TestEnum.Male, @"Male", 1, ExplainAttribute.ERROR_EXPLAIN_TEXT))
                    {
                        return false;
                    }
                    if (!method(TestEnum.Female, @"Female", 81, @"女"))
                    {
                        return false;
                    }
                    if (!method(TestEnum.Test, @"Test", 82, ExplainAttribute.ERROR_EXPLAIN_TEXT))
                    {
                        return false;
                    }
                    return true;
                },
            });
        }