コード例 #1
0
        /// <summary>
        /// Generates businessaction schema file.
        /// </summary>
        /// <returns>generated filename.</returns>
        public static string GenerateXsdValidationSchemaOutputFile()
        {
            string fileName = "../../AccipioTests/Samples/OnlineBankingBusinessActions.xml";
            TestSuiteSchemaGeneratorCommand consoleCommand = new TestSuiteSchemaGeneratorCommand();

            string[] args = new[] { "-ba=" + fileName, "-ns=http://GenerateXsdValidationSchemaTest" };

            Assert.AreEqual(0, consoleCommand.Execute(args));

            // get output file
            return(consoleCommand.TestSuiteSchemaFileName);
        }
コード例 #2
0
        private void AssertTestSuiteXmlFileValidity(bool shouldBeValid)
        {
            try
            {
                // first generate the schema
                TestSuiteSchemaGeneratorCommand cmd = new TestSuiteSchemaGeneratorCommand();
                string[] arguments = new string[] { "-ba=" + BusinessActionsXmlFile, "-ns=http://fikus" };

                Assert.AreEqual(0, cmd.Execute(arguments));

                // now validate our test suite with the generated schema
                XmlValidationHelper helper = new XmlValidationHelper();
                helper.ValidateXmlDocument(TestSuiteXmlFile, cmd.TestSuiteSchemaFileName);
                Assert.IsTrue(shouldBeValid);
            }
            catch (XmlSchemaException ex)
            {
                Assert.IsFalse(shouldBeValid, "Validation failed: '{0}'", ex.Message);
            }
        }