public void CreateFromOntology() { Helper.Print("\n---\n--- Starting CreateFromOntology\n---\n"); DataSchemaAdapter creator = new SqlDataSchemaAdapter(this.Host); 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); // // Make sure that it has been created // using (IDbConnection connection = Connection()) { connection.Open(); using (IDbCommand command = connection.CreateCommand()) { command.CommandText = String.Format("select count(*) from master.dbo.sysdatabases WHERE name = N'{0}'", this.Catalog); Assertion.AssertEquals("Wrong number of databases found", 1, (int)command.ExecuteScalar()); } } }
/// <summary> /// /// </summary> /// <param name="force">should the database be overwritten</param> public void CreateEmptyDB(bool force) { Helper.Print("\n---\n--- Starting CreateEmptyDB\n---\n"); DataSchemaAdapter creator = new SqlDataSchemaAdapter(Host); DataSet dataSet = new DataSet(this.Catalog); creator.Create(dataSet, force); // // Make sure that it has been created // using (IDbConnection connection = Connection()) { connection.Open(); using (IDbCommand command = connection.CreateCommand()) { command.CommandText = String.Format("select count(*) from master.dbo.sysdatabases WHERE name = N'{0}'", this.Catalog); Assertion.AssertEquals("Wrong number of databases found", 1, (int)command.ExecuteScalar()); } } }