Exemple #1
0
        private XmlNode CreateRandomNode(XmlDocument xmldocument)
        {
            char[] ISBN_Sour = new List <char>(CommonData.ASCII_Number())
            {
                '-'
            }.ToArray();
            char[]     Ascii_words        = CommonData.ASCII_WordText();
            char[]     Ascii_lowerenglish = CommonData.ASCII_LowerEnglish();
            XmlElement book = xmldocument.CreateElement(@"book");
            Dictionary <string, string> Dic_Attrs = new Dictionary <string, string>()
            {
                { @"Type", RandomData.GetChineseString(2) + @"课" },
                { @"ISBN", RandomData.GetString(ISBN_Sour, RandomData.GetInt(4, 13)) }
            };

            foreach (KeyValuePair <string, string> item in Dic_Attrs)
            {
                book.SetAttributeNode(XmlHelper.CreateNewAttribute(xmldocument, item.Key, item.Value));
            }
            Dictionary <string, string> Dic_Nodes = new Dictionary <string, string>()
            {
                { @"title", RandomData.GetString(Ascii_words, RandomData.GetInt(4, 10)) },
                { @"author", RandomData.GetString(Ascii_lowerenglish, RandomData.GetInt(2, 4)) },
                { @"price", RandomData.GetDouble().ToString() },
            };

            foreach (KeyValuePair <string, string> item in Dic_Nodes)
            {
                book.AppendChild(XmlHelper.CreateNewElement(xmldocument, item.Key, item.Value));
            }
            return(book);
        }
Exemple #2
0
        public Test_ini()
        {
            this.chars = new char[] { };
            this.chars = CommonData.ASCII_WordText();

            string fp = this.GetFilePath();

            if (File.Exists(fp))
            {
                File.Delete(fp);
            }
            this.ini = new IniFile(fp);
            this.dic = this.GetTestCase();

            NameSign = @"ini配置文件";
            SonCases = new CaseModel[] {
                Func_WriteString(),
                Func_ReadString(),
                Func_GetKeys(),
                Func_GetSections(),
                Func_GetKeyValues(),
                Func_ClearSection(),
                Func_DeleteKey(),
                Func_IsExistsValue(),
            };
        }
 private CaseModel ExeEvent_Section_ASCII_String()
 {
     return(new CaseModel()
     {
         NameSign = @"部分的 ASCII 码字符",
         ExeEvent = () => {
             PrintMethod(@"所有常用字符:", CommonData.ASCII_ALL());
             PrintMethod(@"常用文本字符", CommonData.ASCII_WordText());
             PrintMethod(@"特殊字符:", CommonData.ASCII_Special());
             PrintMethod(@"阿拉伯数字:", CommonData.ASCII_Number());
             PrintMethod(@"小写英文:", CommonData.ASCII_LowerEnglish());
             PrintMethod(@"大写英文:", CommonData.ASCII_UpperEnglish());
         },
     });
 }