예제 #1
0
        public void ValidateNoXmlDeclarationTest()
        {
            var doc       = XDocument.Parse("<databaseSchemaConfiguration xmlns=\"http://www.hypersoa.net/HyperDbXmlSchema\" />");
            var dbManager = new HyperDbXmlScriptProvider();

            dbManager.ValidateDbXmlDocument(doc, null, false);
        }
예제 #2
0
        public void ValidateHyperDbSchemaTest()
        {
            var doc       = XDocument.Load("TestHyperDbSchema.xml");
            var dbManager = new HyperDbXmlScriptProvider();

            dbManager.ValidateDbXmlDocument(doc, null, false);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }