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); }
private IEnumerable <ResultOfTest> GetTestResultsCollection(string clientCallXml) { string text = System.IO.File.ReadAllText(clientCallXml); return(ClientCallsXmlParser.ParseXml(text)); }