public void IsValidXmlMissingFileTest() { var path = Path.GetTempFileName(); File.Delete(path); Assert.IsFalse(resultParser.IsValidXml(path, out var jargon), "missing file"); }
public void IsValidXmlTest(XmlResultJargon jargon) { var path = CreateResultSample(jargon); Assert.IsTrue(XmlResultParser.IsValidXml(path, out var resultJargon), "is valid"); Assert.AreEqual(jargon, resultJargon, "jargon"); File.Delete(path); }
public void CleanXmlPingTest(XmlResultJargon jargon) { var path = CreateResultSample(jargon, includePing: true); var cleanPath = path + "_clean"; XmlResultParser.CleanXml(path, cleanPath); Assert.IsTrue(XmlResultParser.IsValidXml(cleanPath, out var resultJargon), "is valid"); Assert.AreEqual(jargon, resultJargon, "jargon"); File.Delete(path); File.Delete(cleanPath); }
public void CleanXmlTouchUnitTest() { // similar to CleanXmlPingTest but using TouchUnit, so we do not want to see the extra nodes var path = CreateResultSample(XmlResultJargon.TouchUnit, includePing: true); var cleanPath = path + "_clean"; XmlResultParser.CleanXml(path, cleanPath); Assert.IsTrue(XmlResultParser.IsValidXml(cleanPath, out var resultJargon), "is valid"); Assert.AreEqual(XmlResultJargon.NUnitV2, resultJargon, "jargon"); // load the xml, ensure we do not have the nodes we removed var doc = XDocument.Load(cleanPath); Assert.IsFalse(doc.Descendants().Where(e => e.Name == "TouchUnitTestRun").Any(), "TouchUnitTestRun"); Assert.IsFalse(doc.Descendants().Where(e => e.Name == "NUnitOutput").Any(), "NUnitOutput"); File.Delete(path); File.Delete(cleanPath); }