protected override XmlDocument LoadXmlTestResult() { //transform MsTest result to nunit and return xmlTestResultDoc = new XmlDocument(); xmlTestResultDoc.Load(reportParameters.XmlTestResult); namespaceURI = xmlTestResultDoc.SelectSingleNode("/*").NamespaceURI; var nameTable = GetNameTable(); XslCompiledTransform xslt = new XslCompiledTransform(); using (var xsltReader = new ResourceXmlReader(typeof(MsTestExecutionReportGenerator), "MsTestToNUnit.xslt", nameTable)) { var resourceResolver = new XmlResourceResolver(); var xsltSettings = new XsltSettings(true, false); xslt.Load(xsltReader, xsltSettings, resourceResolver); } var writerStream = new MemoryStream(); using (var xmlTextWriter = new XmlTextWriter(writerStream, Encoding.UTF8)) { xslt.Transform(xmlTestResultDoc, xmlTextWriter); } writerStream = new MemoryStream(writerStream.GetBuffer()); XmlDocument result = new XmlDocument(); result.Load(writerStream); return result; }
protected override XmlDocument LoadXmlTestResult() { //transform MsTest result to nunit and return XslCompiledTransform xslt = new XslCompiledTransform(); using (var xsltReader = new ResourceXmlReader(typeof(MsTestExecutionReportGenerator), "MsTestToNUnit.xslt")) { var resourceResolver = new XmlResourceResolver(); var xsltSettings = new XsltSettings(true, false); xslt.Load(xsltReader, xsltSettings, resourceResolver); } var writerStream = new MemoryStream(); using (var xmlTextWriter = new XmlTextWriter(writerStream, Encoding.UTF8)) { xslt.Transform(reportParameters.XmlTestResult, xmlTextWriter); } writerStream = new MemoryStream(writerStream.GetBuffer()); XmlDocument result = new XmlDocument(); result.Load(writerStream); return result; }