Beispiel #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();
            }
        }
Beispiel #2
0
        public void TestNoColumns1()
        {
            DataSet ds = new DataSet(Catalog);

            ds.Tables.Add("empty_table");

            DataSchemaAdapter creator = new JetDataSchemaAdapter();

            creator.Create(ds, false);
        }
Beispiel #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);
        }
Beispiel #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();
            }
        }
Beispiel #5
0
        public void TestUnnamedDataSet()
        {
            DataSchemaAdapter creator = new JetDataSchemaAdapter();

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

            Assert.Throws <ArgumentNullException>(() => creator.Create((DataSet)null, false));
        }
Beispiel #7
0
 /// <summary>
 /// Returns a properly formatted connection string.
 /// </summary>
 /// <returns>A properly formatted connection string</returns>
 public override IDbConnection Connection()
 {
     return(new OleDbConnection(JetDataSchemaAdapter.GetConnectionString(Catalog)));
 }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 public void CleanUp()
 {
     File.Delete(JetDataSchemaAdapter.GetPath(Catalog));
 }