Beispiel #1
0
        //   <------------------parses request and returns in list form------------------------->
        public List <TestRequestData> parseXMLRequest(String XmlRequest)
        {
            List <TestRequestData> testList_ = new List <TestRequestData>();
            TextReader             tr        = new StringReader(XmlRequest);

            try
            {
                XDocument doc;
                testList_ = new List <TestRequestData>();
                doc       = XDocument.Load(tr);
                if (doc == null)
                {
                    return(null);
                }
                string          author = doc.Descendants("author").First().Value;
                TestRequestData test   = null;
                XElement[]      xtests = doc.Descendants("test").ToArray();

                int numTests = xtests.Count();
                for (int i = 0; i < numTests; ++i)
                {
                    test            = new TestRequestData();
                    test.testCode   = new List <string>();
                    test.authorName = author;
                    test.timeStamp  = DateTime.Now;
                    test.testName   = xtests[i].Attribute("name").Value;
                    test.toolChain  = xtests[i].Element("toolChain").Value;
                    test.testDriver = xtests[i].Element("testDriver").Value;
                    IEnumerable <XElement> xtestCode = xtests[i].Elements("tested");
                    foreach (var xlibrary in xtestCode)
                    {
                        test.testCode.Add(xlibrary.Value);
                    }
                    test.showTestRequest();
                    testList_.Add(test);
                }
                return(testList_);
            }
            catch (Exception e)
            {
                Console.Write("\n Excetion Caught while parsing::" + e.Message);
            }
            finally
            {
                tr.Close();
            }
            return(testList_);
        }
Beispiel #2
0
        //-------------------< To create a build request on files selected b the user >--------------
        void testHelper()
        {
            TestRequestData td    = new TestRequestData();
            int             count = testcase.SelectedItems.Count;
            StringBuilder   f1    = new StringBuilder(count);

            f1.Append("TestName : Test");
            int    i  = 0;
            string m1 = "Please select a Test Driver";

            if (testDrivers.SelectedItems.Count <= 0)
            {
                System.Windows.MessageBox.Show(m1);
            }
            foreach (String tdriver in testDrivers.SelectedItems)
            {
                td.testDriver = tdriver;
                f1.Append("\n" + Path.GetFileName(tdriver));
            }
            td.testCode = new List <String>(testcase.SelectedItems.Count);
            foreach (String l1 in testcase.SelectedItems)
            {
                td.testCode.Add(l1);
                i += 1;
                f1.Append("\n" + Path.GetFileName(l1));
            }
            td.testName   = "test";
            td.authorName = "Harika";
            td.toolChain  = "C#";
            Console.WriteLine("\n-----Test Added to Build Request\n");
            td.showTestRequest();
            tdList.Add(td);
            Dispatcher.Invoke(
                new Action <StringBuilder>(addAddedTests),
                System.Windows.Threading.DispatcherPriority.Background,
                new StringBuilder[] { f1 }
                );
        }