Example #1
0
        // Generate a results file for XenAdminTests.SearchTests.ExpectedResults.
        // Run XenCenter, then in the immediate window run:
        //    XenAdmin.TestResources.XenSearchQueryTest.SaveResults(filename);
        // This will save the results of all the searches you have loaded.
        public static void SaveResults(string filename)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement resultsElement = doc.CreateElement("results");
            doc.AppendChild(resultsElement);

            foreach (Search search in Search.Searches)
            {
                XmlElement searchElement = doc.CreateElement("search");
                resultsElement.AppendChild(searchElement);
                XmlAttribute uuidAttr = doc.CreateAttribute("uuid");
                uuidAttr.Value = search.UUID;
                searchElement.Attributes.Append(uuidAttr);

                IAcceptGroups adapter = new XmlResultsAdapter(doc, searchElement);

                search.PopulateAdapters(adapter);
            }

            doc.Save(filename);
        }
Example #2
0
        // Generate a results file for XenAdminTests.SearchTests.ExpectedResults.
        // Run XenCenter, then in the immediate window run:
        //    XenAdmin.TestResources.XenSearchQueryTest.SaveResults(filename);
        // This will save the results of all the searches you have loaded.
        public static void SaveResults(string filename)
        {
            XmlDocument doc            = new XmlDocument();
            XmlElement  resultsElement = doc.CreateElement("results");

            doc.AppendChild(resultsElement);

            foreach (Search search in Search.Searches)
            {
                XmlElement searchElement = doc.CreateElement("search");
                resultsElement.AppendChild(searchElement);
                XmlAttribute uuidAttr = doc.CreateAttribute("uuid");
                uuidAttr.Value = search.UUID;
                searchElement.Attributes.Append(uuidAttr);

                IAcceptGroups adapter = new XmlResultsAdapter(doc, searchElement);

                search.PopulateAdapters(adapter);
            }

            doc.Save(filename);
        }