示例#1
0
        /// <summary>
        /// Open file dialog and load selected xml file into treeview.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenToolStripMenuItemClick(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.OK) // Test result.
            {
                XMLSuite a = new XMLSuite(this.openFileDialog.FileName);
                List<TestSuite> suites = a.MakeTestSuite();

                foreach (TestSuite suite in suites)
                {
                    this.testSuiteTreeView.GenerateTreeNode(suite);
                }
            }
        }
        /// <summary>
        /// Show Dialog to select suites and make xml file with them.
        /// </summary>
        /// <param name="fileName"></param>
        public void GenerateXmlFile(string fileName)
        {
            SuiteExportChoseForm exportDialog = new SuiteExportChoseForm(suiteTreeView.Nodes);

            if (exportDialog.ShowDialog() == DialogResult.OK)
            {
                List<TestSuite> suites = this.MakeSuiteList(exportDialog.Nodes);

                for (int i = 0; i < suites.Count; i++)
                {
                    XMLSuite xml = new XMLSuite(suites[i]);

                    //foreach (TestSuite suite in suites)
                    //	xml.AddSuite(suite);

                    xml.SaveAs(Path.GetDirectoryName(fileName)+'\\' + Path.GetFileNameWithoutExtension(fileName) + i+".xml");
                }
            }
        }