public void CanParseValidator() { StringBuilder validatorString = new StringBuilder(); validatorString.AppendLine("<nhv-mapping xmlns=\"urn:nhibernate-validator-1.0\">"); validatorString.AppendLine("<class name=\"Validator.Test.TvOwner, Validator.Test\">"); validatorString.AppendLine("<property name=\"tv\">"); validatorString.AppendLine("<not-null />"); validatorString.AppendLine("</property>"); validatorString.AppendLine("</class>"); validatorString.AppendLine("</nhv-mapping>"); XmlTextReader xml = new XmlTextReader(validatorString.ToString(), XmlNodeType.Document, null); IMappingDocumentParser parser = new MappingDocumentParser(); NhvMapping validator = parser.Parse(xml); Assert.IsNotNull(validator); }
public void MappingDocumentParserTest() { // here we test only the exception since the other tests are included in MappingLoader MappingDocumentParser mdp = new MappingDocumentParser(); mdp.Parse(null); }
public void MappingDocumentParserTest() { // here we test only the exception since the other tests are included in MappingLoader MappingDocumentParser mdp = new MappingDocumentParser(); ActionAssert.Throws<ArgumentNullException>(() => mdp.Parse(null)); }
public void AddXmlReader(XmlTextReader reader, string fileName) { IMappingDocumentParser parser = new MappingDocumentParser(); try { AddMapping(parser.Parse(reader)); } catch(Exception e) { throw new ValidatorConfigurationException("Could not load file " + fileName, e); } }