예제 #1
0
        public static IEnumerable <ResultOfTest> ParseXml(string xml)
        {
            XNamespace namespaceWcs           = @"http://schemas.datacontract.org/2004/07/Microsoft.GFS.WCS.Test.Framework";
            XDocument  xDocument              = XDocument.Parse(xml);
            IEnumerable <ResultOfTest> result = from resultOfTest in xDocument.Descendants(namespaceWcs + "ResultOfTest")
                                                select new ResultOfTest()
            {
                ErrorMessage = resultOfTest.Element(namespaceWcs + "ErrorMessage").SafeElementValue(),
                RestUri      = resultOfTest.Element(namespaceWcs + "RestUri").SafeElementValue(),
                ApiName      = ClientCallsXmlParser.GetApiName(resultOfTest.Element(namespaceWcs + "RestUri").SafeElementValue()),
                StartTime    = ClientCallsXmlParser.GetTrimmedValue(
                    resultOfTest.Element(namespaceWcs + "StartTime").SafeElementValue(),
                    'T',
                    'Z'),
                State = resultOfTest.Element(namespaceWcs + "State").SafeElementValue(),
                TotalExecutionTime = ClientCallsXmlParser.GetExecutionTimeInSec(
                    resultOfTest.Element(namespaceWcs + "TotalExecutionTime").SafeElementValue())
            };

            return(result);
        }
예제 #2
0
        private IEnumerable <ResultOfTest> GetTestResultsCollection(string clientCallXml)
        {
            string text = System.IO.File.ReadAllText(clientCallXml);

            return(ClientCallsXmlParser.ParseXml(text));
        }