public class ClassMapTester { protected XmlElement currentElement; protected XmlDocument document; protected XmlNamespaceManager mgr; public ClassMapTester ForString(string input) { document = new XmlDocument(); document.LoadXml(input); return For(document); } public ClassMapTester For(XmlDocument doc) { document = doc; SetNameSpaceManager(); return this; } public ClassMapTester For() where A : ClassMap, new() { For(new A().CreateMapping(new MappingVisitor())); return this; } private void SetNameSpaceManager() { mgr = new XmlNamespaceManager(new NameTable()); mgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2"); } //.... }
Which allow me to write a Fluent-Nhhbernate ClassMap unit test like this:
[Test]public void LanguageMap_Creates_Valid_Mapping(){ new ClassMapTester().For() .TestDefaultConventions() .TestProperty("LanguageName", "8", "true").Exists() .TestProperty("LanguageDisplayName", "50", "true").Exists();}
I am always interested in hearing about new opportunities. Feel free to contact me about your project and the amazing software we can make together. Look at My Resume
World of Warcraft Steam Community MySpace FaceBook LinkedIn Twitter BrightKite Reading List Source Code Repository