Beispiel #1
0
        public static void Main4()
        {
            testlink tl = new testlink(null);

            //testlink.saveToFile(tl.getTestsuite(), "");
            // ts.Items.Add();
            //StreamReader str = new StreamReader(@"F:\vs\all_testsuites_u8.xml");
            //XmlSerializer xSerializer = new XmlSerializer(typeof(testsuite));

            //ts = (testsuite)xSerializer.Deserialize(str);

            /* foreach (GetBusinessCardCallResponseBusinessCards result in bcResponse.Items.ToList<GetBusinessCardCallResponseBusinessCards>())
             * {
             *   var businessCards = result.BusinessCard.ToArray<GetBusinessCardCallResponseBusinessCardsBusinessCard>();
             *   foreach (GetBusinessCardCallResponseBusinessCardsBusinessCard bc in businessCards) {
             *       Console.Write(bc.firstName);
             *       Console.Write(" ");
             *       Console.WriteLine(bc.lastName);
             *   }
             *   Console.WriteLine();
             * }*/

            //str.Close();
            Console.ReadLine();
        }
        public void bToTL_Click(object sender, EventArgs e)
        {
            if (!initTestcaseBox())
            {
                return;
            }
            bToTL.Enabled = false;
            Excel.Worksheet sheet = app.ActiveWorkbook.ActiveSheet as Excel.Worksheet;
            int             rows  = sheet.UsedRange.Rows.Count;
            testlink        tl    = new testlink(this);

            for (int i = 3; i < rows; i++)
            {
                Excel.Range tmprange = sheet.Range["A" + i, Type.Missing].EntireRow;
                Array       values   = (Array)tmprange.Cells.Value2;
                object      o        = values.GetValue(1, 1);
                if (o == null)
                {
                    this.AppendLine("stop on row " + i);
                    break;
                }
                string c1   = o.ToString();
                int    deep = c1.Split(new string[] { "_" }, StringSplitOptions.None).Length - 1;
                if (deep == 4)
                {
                    DefaultTC itc = (DefaultTC)this.cbScriptType.SelectedItem;
                    i = tl.addTestcases(sheet, itc, i);
                }
                else
                {
                    tl.addItems(deep, values.GetValue(1, 2).ToString(), c1);
                }
            }
            String name = app.ActiveWorkbook.Name.Split('.')[0].Trim();

            tl.saveToFile(tbXML.Text, name);
            this.AppendLine(name + " transform finished!");
            //Console.WriteLine("Save to " + tl.saveToFile(tbXML.Text));
            bToTL.Enabled = true;
        }
        public void bToTL_Click(object sender, EventArgs e)
        {
            if (!initTestcaseBox())
            {
                return;
            }
            bToTL.Enabled = false;
            Excel.Worksheet sheet = app.ActiveWorkbook.ActiveSheet as Excel.Worksheet;
            int rows = sheet.UsedRange.Rows.Count;
            testlink tl = new testlink(this);

            for (int i = 3; i < rows; i++)
            {
                Excel.Range tmprange = sheet.Range["A" + i, Type.Missing].EntireRow;
                Array values = (Array)tmprange.Cells.Value2;
                object o = values.GetValue(1, 1);
                if (o == null)
                {
                    this.AppendLine("stop on row "+i);
                    break;
                }
                string c1 = o.ToString();
                int deep = c1.Split(new string[] { "_" }, StringSplitOptions.None).Length-1;
                if (deep == 4)
                {
                    DefaultTC itc = (DefaultTC)this.cbScriptType.SelectedItem;
                    i=tl.addTestcases(sheet, itc, i);
                }
                else
                {
                    tl.addItems(deep, values.GetValue(1, 2).ToString(), c1);
                }
            }
            String name = app.ActiveWorkbook.Name.Split('.')[0].Trim();
            tl.saveToFile(tbXML.Text, name);
            this.AppendLine(name + " transform finished��");
            //Console.WriteLine("Save to " + tl.saveToFile(tbXML.Text));
            bToTL.Enabled = true;
        }
        public static void Main4()
        {
            testlink tl = new testlink(null);
            //testlink.saveToFile(tl.getTestsuite(), "");
               // ts.Items.Add();
            //StreamReader str = new StreamReader(@"F:\vs\all_testsuites_u8.xml");
            //XmlSerializer xSerializer = new XmlSerializer(typeof(testsuite));

            //ts = (testsuite)xSerializer.Deserialize(str);
               /* foreach (GetBusinessCardCallResponseBusinessCards result in bcResponse.Items.ToList<GetBusinessCardCallResponseBusinessCards>())
            {
                var businessCards = result.BusinessCard.ToArray<GetBusinessCardCallResponseBusinessCardsBusinessCard>();
                foreach (GetBusinessCardCallResponseBusinessCardsBusinessCard bc in businessCards) {
                    Console.Write(bc.firstName);
                    Console.Write(" ");
                    Console.WriteLine(bc.lastName);
                }
                Console.WriteLine();
            }*/

            //str.Close();
            Console.ReadLine();
        }