public void ValidateNoXmlDeclarationTest() { var doc = XDocument.Parse("<databaseSchemaConfiguration xmlns=\"http://www.hypersoa.net/HyperDbXmlSchema\" />"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ValidateDbXmlDocument(doc, null, false); }
public void ValidateHyperDbSchemaTest() { var doc = XDocument.Load("TestHyperDbSchema.xml"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ValidateDbXmlDocument(doc, null, false); }
public void ValidateCustomDbSchemaTest() { var doc = XDocument.Load("TestCustomDbSchema.xml"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ClearDbXmlSchemas(); dbManager.AddDbXmlSchema(null, "TestCustomDbXmlSchema.xsd"); dbManager.ValidateDbXmlDocument(doc, null, false); }
public void ValidateXmlDeclarationNoRootTest() { Exception testEx = null; try { var doc = XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ValidateDbXmlDocument(doc, null, false); } catch (Exception ex) { testEx = ex; } // If the expected exception was thrown, the test was successful Assert.IsNotNull(testEx); Assert.IsTrue(testEx is XmlException); }
public void ValidateMultipleRootNodeTest() { Exception testEx = null; try { var doc = XDocument.Parse("<root1 /><root2 />"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ValidateDbXmlDocument(doc, null, false); } catch (Exception ex) { testEx = ex; } // If the expected exception was thrown, the test was successful Assert.IsNotNull(testEx); Assert.IsTrue(testEx is XmlException); }
public void ValidateCustomAgainstHyperDbSchemaTest() { Exception testEx = null; try { var doc = XDocument.Load("TestCustomDBSchema.xml"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.ValidateDbXmlDocument(doc, null, false); } catch (Exception ex) { testEx = ex; } // If the expected exception was thrown, the test was successful Assert.IsNotNull(testEx); Assert.IsTrue(testEx is XmlSchemaValidationException); }
public void ValidateNoNamespaceTest() { Exception testEx = null; try { var doc = XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><databaseSchemas />"); var dbManager = new HyperDbXmlScriptProvider(); dbManager.AddDbXmlSchema(null, "TestCustomDbXmlSchema.xsd"); dbManager.ValidateDbXmlDocument(doc, null, false); } catch (Exception ex) { testEx = ex; } // If the expected exception was thrown, the test was successful Assert.IsNotNull(testEx); Assert.IsTrue(testEx is XmlSchemaValidationException); }