public void TestWithInvalidDocument() { //---------------Set up test pack------------------- XmlDocumentValidator validator = new XmlDocumentValidator(); //---------------Execute Test ---------------------- try { validator.ValidateDocument(itsXmlDocument.Replace("oneprop", "twoprop"), "test", itsDTD); Assert.Fail("Expected to throw an InvalidXmlDefinitionException"); } //---------------Test Result ----------------------- catch (InvalidXmlDefinitionException ex) { StringAssert.Contains("The relationship node does not conform to the dtd.The 'twoprop' element is not declared", ex.Message); } }
public void TestValidateDocument() { XmlDocumentValidator validator = new XmlDocumentValidator(); validator.ValidateDocument(itsXmlDocument, "test", itsDTD); }