示例#1
0
        // AS: this test fails with the message
        // "'abstract_element_definition__slot__members__abstract_element_definition'
        // is not a valid name.  Make sure that it
        // 'abstract_element_definition__slot__members__abstract_element_definition' is not a
        // valid name.  Make sure that it does not include invalid characters or punctuation
        // and that it is not too long.
        public void CreateFromOntology()
        {
            Helper.Print("\n---\n--- Starting CreateFromOntology\n---\n");

            DataSchemaAdapter creator = new JetDataSchemaAdapter();
            DataSet           dataSet = new DataSet(this.Catalog);

            string xsdFile = ConfigurationManager.AppSettings["Test.ObjectModelXsd"];

            if (xsdFile == null || xsdFile.Length == 0)
            {
                xsdFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Test\ObjectModel.xsd");
            }

            dataSet.ReadXmlSchema(xsdFile);
            dataSet.DataSetName = this.Catalog;

            creator.Create(dataSet, true);

            Assertion.Assert(File.Exists(JetDataSchemaAdapter.GetPath(this.Catalog)));

            //
            // Can we open it?
            //
            using (IDbConnection connection = Connection())
            {
                connection.Open();
            }
        }
示例#2
0
        public void TestNoColumns1()
        {
            DataSet ds = new DataSet(Catalog);

            ds.Tables.Add("empty_table");

            DataSchemaAdapter creator = new JetDataSchemaAdapter();

            creator.Create(ds, false);
        }
示例#3
0
        public void TestNoColumns2()
        {
            string  name = "TestNoColumns2";
            string  file = String.Format("{0}.xsd", name);
            DataSet ds   = new DataSet(Catalog);

            ds.Tables.Add("empty_table_1");
            ds.Tables.Add("empty_table_2");
            ds.WriteXmlSchema(file);
            ds.Dispose();
            ds = new DataSet();
            ds.ReadXmlSchema(file);
            DataSchemaAdapter creator = new JetDataSchemaAdapter();

            creator.Create(ds, false);
        }
示例#4
0
        public void CreateEmptyDB()
        {
            Helper.Print("\n---\n--- Starting CreateEmptyDB\n---\n");

            DataSchemaAdapter creator = new JetDataSchemaAdapter();
            DataSet           dataSet = new DataSet(this.Catalog);

            creator.Create(dataSet, true);

            Assertion.Assert(File.Exists(JetDataSchemaAdapter.GetPath(this.Catalog)));

            //
            // Can we open it?
            //
            using (IDbConnection connection = Connection())
            {
                connection.Open();
            }
        }
示例#5
0
        public void TestUnnamedDataSet()
        {
            DataSchemaAdapter creator = new JetDataSchemaAdapter();

            Assert.Throws <ArgumentException>(() => creator.Create(new DataSet(String.Empty), false));
        }
示例#6
0
        public void TestNullDataSet()
        {
            DataSchemaAdapter creator = new JetDataSchemaAdapter();

            Assert.Throws <ArgumentNullException>(() => creator.Create((DataSet)null, false));
        }