public void AssertXslTransformResultsWorksWithStrings() { string xslt = XsltTests.IDENTITY_TRANSFORM; string someXml = "<a><b>c</b><b/></a>"; OldXmlAssert.XslTransformResults(xslt, someXml, someXml); }
public void AssertStringEqualAndIdenticalToSelf() { string control = _xmlTrueTest; string test = _xmlTrueTest; OldXmlAssert.XmlIdentical(control, test); OldXmlAssert.XmlEquals(control, test); }
public void AssertDifferentStringsNotEqualNorIdentical() { string control = "<assert>true</assert>"; string test = "<assert>false</assert>"; XmlDiff xmlDiff = new XmlDiff(control, test); OldXmlAssert.XmlNotIdentical(xmlDiff); OldXmlAssert.XmlNotEquals(xmlDiff); }
[Test] public void AssertXPathEvaluatesToWorksConstantExpression() { OldXmlAssert.XPathEvaluatesTo("true()", MY_SOLAR_SYSTEM, "True"); OldXmlAssert.XPathEvaluatesTo("false()", MY_SOLAR_SYSTEM, "False"); }
public void AssertXmlValidTrueForValidFile() { StreamReader reader = new StreamReader(ValidatorTests.ValidFile); try { OldXmlAssert.XmlValid(reader); } finally { reader.Close(); } }
public void AssertXslTransformResultsWorksWithXmlInput() { StreamReader xsl = ValidatorTests.GetTestReader("animal.xsl"); XmlInput xslt = new XmlInput(xsl); StreamReader xml = ValidatorTests.GetTestReader("testAnimal.xml"); XmlInput xmlToTransform = new XmlInput(xml); XmlInput expectedXml = new XmlInput("<dog/>"); OldXmlAssert.XslTransformResults(xslt, xmlToTransform, expectedXml); }
[Test] public void AssertXPathExistsFailsForNonExistentXPath() { try { OldXmlAssert.XPathExists("//star[@name='alpha centauri']", MY_SOLAR_SYSTEM); Assert.Fail("Expected assertion failure"); } catch (AssertionException e) { AvoidUnusedVariableCompilerWarning(e); } }
public void XmlEqualsWithXmlDiffFail_WithDiffConfiguration(string optionalDesciption, string expectedMessage) { try { OldXmlAssert.XmlEquals(new XmlDiff(new XmlInput(_xmlTrueTest), new XmlInput(_xmlFalseTest), new DiffConfiguration(optionalDesciption))); } catch (AssertionException e) { Assert.AreEqual(true, e.Message.StartsWith(expectedMessage)); } }
public void XmlEqualsWithXmlDiffFail_WithNullOptionalDescription() { try { OldXmlAssert.XmlEquals(new XmlDiff(new XmlInput(_xmlTrueTest), new XmlInput(_xmlFalseTest), new DiffConfiguration(null))); } catch (AssertionException e) { Assert.AreEqual(true, e.Message.StartsWith("Xml does not match")); } }
public void AssertXmlEqualsUsesOptionalDescription() { string description = "Another Optional Description"; try { XmlDiff diff = new XmlDiff(new XmlInput("<a/>"), new XmlInput("<b/>"), new DiffConfiguration(description)); OldXmlAssert.XmlEquals(diff); } catch (AssertionException e) { Assert.AreEqual(true, e.Message.StartsWith(description)); } }
public void AssertXmlValidFalseForInvalidFile() { StreamReader reader = new StreamReader(ValidatorTests.InvalidFile); try { OldXmlAssert.XmlValid(reader); Assert.Fail("Expected assertion failure"); } catch (AssertionException e) { AvoidUnusedVariableCompilerWarning(e); } finally { reader.Close(); } }
public void AssertXslTransformResultsCatchesFalsePositive() { StreamReader xsl = ValidatorTests.GetTestReader("animal.xsl"); XmlInput xslt = new XmlInput(xsl); StreamReader xml = ValidatorTests.GetTestReader("testAnimal.xml"); XmlInput xmlToTransform = new XmlInput(xml); XmlInput expectedXml = new XmlInput("<cat/>"); bool exceptionExpected = true; try { OldXmlAssert.XslTransformResults(xslt, xmlToTransform, expectedXml); exceptionExpected = false; Assert.Fail("Expected dog not cat!"); } catch (AssertionException e) { AvoidUnusedVariableCompilerWarning(e); if (!exceptionExpected) { throw e; } } }
public void XmlEqualsWithXmlDiffFail() { OldXmlAssert.XmlEquals(new XmlDiff(new XmlInput(_xmlTrueTest), new XmlInput(_xmlFalseTest))); }
public void XmlEqualsWithXmlDiff() { OldXmlAssert.XmlEquals(new XmlDiff(_xmlTrueTest, _xmlTrueTest)); }
public void XmlEqualsWithXmlInput() { OldXmlAssert.XmlEquals(new XmlInput(_xmlTrueTest), new XmlInput(_xmlTrueTest)); }
public void XmlEqualsWithStringFail() { OldXmlAssert.XmlEquals(_xmlTrueTest, _xmlFalseTest); }
public void XmlEqualsWithTextReaderFail() { OldXmlAssert.XmlEquals(new StringReader(_xmlTrueTest), new StringReader(_xmlFalseTest)); }
[Test] public void AssertXPathExistsWorksForExistentXPath() { OldXmlAssert.XPathExists("//planet[@name='Earth']", MY_SOLAR_SYSTEM); }
[Test] public void AssertXPathEvaluatesToWorksForNonMatchingExpression() { OldXmlAssert.XPathEvaluatesTo("//planet[@position='4']/@supportsLife", MY_SOLAR_SYSTEM, ""); }