[Adapdev-commits] Adapdev/src/Adapdev.Data.Tests/Schema SchemaBuilderTest.cs,1.2,1.3
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2006-03-18 09:59:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13506/src/Adapdev.Data.Tests/Schema Modified Files: SchemaBuilderTest.cs Log Message: Index: SchemaBuilderTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Schema/SchemaBuilderTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SchemaBuilderTest.cs 15 Mar 2006 04:34:19 -0000 1.2 --- SchemaBuilderTest.cs 18 Mar 2006 09:59:24 -0000 1.3 *************** *** 16,20 **** { ! private string _oledbConnectionString = "Provider=sqloledb;Data Source=localhost;Initial Catalog=northwind;User Id=sa;Password=;"; private string _mysqlConnectionString = "Data Source=localhost;Database=codus_test;User ID=;Password=;"; --- 16,23 ---- { ! private string _oledbSqlServerConnectionString = "Provider=sqloledb;Data Source=localhost;Initial Catalog=northwind;User Id=sa;Password=;"; ! private string _oledbOracleConnectionString = "Provider=msdaora; Data Source=adapdev; Database=; User ID=hr; Password=test;"; ! private string _oledbAccessConnectionString = String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}\codustest.mdb; User ID=; Password=;", AppDomain.CurrentDomain.BaseDirectory); ! private string _oledbMSDEConnectionString = String.Format(@"Provider=SQLNCLI;Server=(local)\SQLExpress;Database=aspnetdb;Trusted_Connection=Yes;", AppDomain.CurrentDomain.BaseDirectory); private string _mysqlConnectionString = "Data Source=localhost;Database=codus_test;User ID=;Password=;"; *************** *** 22,26 **** public void BuildSqlServerOleDbSchema() { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbConnectionString, Adapdev.Data.DbType.SQLSERVER, Adapdev.Data.DbProviderType.OLEDB); Assert.AreEqual(29, ds.Tables.Count, "Northwind should have 29 tables / views."); Assert.IsTrue(ds.Tables.Contains("Orders")); --- 25,29 ---- public void BuildSqlServerOleDbSchema() { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbSqlServerConnectionString, Adapdev.Data.DbType.SQLSERVER, Adapdev.Data.DbProviderType.OLEDB); Assert.AreEqual(29, ds.Tables.Count, "Northwind should have 29 tables / views."); Assert.IsTrue(ds.Tables.Contains("Orders")); *************** *** 28,37 **** Assert.AreEqual(Adapdev.Data.DbType.SQLSERVER, ds.DatabaseType, "DataTypes don't match."); Assert.AreEqual("dbo", ds.GetTable("Orders").SchemaName); // Console.WriteLine(ds.GetTable("Orders")); ! foreach(ColumnSchema column in ds.GetTable("Orders").Columns.Values) ! { ! Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! } } --- 31,96 ---- Assert.AreEqual(Adapdev.Data.DbType.SQLSERVER, ds.DatabaseType, "DataTypes don't match."); Assert.AreEqual("dbo", ds.GetTable("Orders").SchemaName); + // Console.WriteLine(ds.GetTable("Orders")); + // foreach(ColumnSchema column in ds.GetTable("Orders").Columns.Values) + // { + // Console.WriteLine("{0} : {1}", column.Name, column.DataType); + // } ! } ! ! [Test] ! public void BuildOracleOleDbSchema() ! { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbOracleConnectionString, Adapdev.Data.DbType.ORACLE, Adapdev.Data.DbProviderType.OLEDB, "HR", null); ! Assert.AreEqual(8, ds.Tables.Count, "HR should have 8 tables / views."); ! Assert.IsTrue(ds.Tables.Contains("EMPLOYEES"), "Employees table not found."); ! Assert.AreEqual(Adapdev.Data.DbProviderType.OLEDB, ds.DatabaseProviderType, "ProviderTypes don't match."); ! Assert.AreEqual(Adapdev.Data.DbType.ORACLE, ds.DatabaseType, "DataTypes don't match."); ! Assert.AreEqual("HR", ds.GetTable("EMPLOYEES").SchemaName); ! ! // Console.WriteLine(ds.GetTable("COUNTRIES")); ! // foreach(ColumnSchema column in ds.GetTable("EMPLOYEES").SortedColumns.Values) ! // { ! // Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! // } ! ! } ! ! [Test] ! public void BuildAccessOleDbSchema() ! { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbAccessConnectionString, Adapdev.Data.DbType.ACCESS, Adapdev.Data.DbProviderType.OLEDB); ! Console.WriteLine(ds.Tables.Count.ToString()); ! ! Assert.AreEqual(13, ds.Tables.Count, "Access should have 8 tables / views."); ! Assert.IsTrue(ds.Tables.Contains("Text"), "Text table not found."); ! Assert.AreEqual(Adapdev.Data.DbProviderType.OLEDB, ds.DatabaseProviderType, "ProviderTypes don't match."); ! Assert.AreEqual(Adapdev.Data.DbType.ACCESS, ds.DatabaseType, "DataTypes don't match."); ! Assert.AreEqual("", ds.GetTable("Text").SchemaName); ! // Console.WriteLine(ds.GetTable("Text")); ! // foreach(ColumnSchema column in ds.GetTable("Text").SortedColumns.Values) ! // { ! // Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! // } ! ! } ! ! [Test] ! public void BuildMSDEOleDbSchema() ! { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbMSDEConnectionString, Adapdev.Data.DbType.SQLSERVER, Adapdev.Data.DbProviderType.OLEDB); ! Console.WriteLine(ds.Tables.Count.ToString()); ! ! Assert.AreEqual(13, ds.Tables.Count, "Access should have 8 tables / views."); ! Assert.IsTrue(ds.Tables.Contains("Text"), "Text table not found."); ! Assert.AreEqual(Adapdev.Data.DbProviderType.OLEDB, ds.DatabaseProviderType, "ProviderTypes don't match."); ! Assert.AreEqual(Adapdev.Data.DbType.ACCESS, ds.DatabaseType, "DataTypes don't match."); ! Assert.AreEqual("", ds.GetTable("Text").SchemaName); ! // Console.WriteLine(ds.GetTable("Text")); ! // foreach(ColumnSchema column in ds.GetTable("Text").SortedColumns.Values) ! // { ! // Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! // } } *************** *** 40,44 **** public void BuildSqlServerSqlSchema() { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbConnectionString, Adapdev.Data.DbType.SQLSERVER, Adapdev.Data.DbProviderType.SQLSERVER); Assert.AreEqual(29, ds.Tables.Count, "Northwind should have 29 tables / views."); Assert.IsTrue(ds.Tables.Contains("Orders")); --- 99,103 ---- public void BuildSqlServerSqlSchema() { ! DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._oledbSqlServerConnectionString, Adapdev.Data.DbType.SQLSERVER, Adapdev.Data.DbProviderType.SQLSERVER); Assert.AreEqual(29, ds.Tables.Count, "Northwind should have 29 tables / views."); Assert.IsTrue(ds.Tables.Contains("Orders")); *************** *** 46,53 **** Assert.AreEqual(Adapdev.Data.DbType.SQLSERVER, ds.DatabaseType, "DataTypes don't match."); ! foreach(ColumnSchema column in ds.GetTable("Orders").Columns.Values) ! { ! Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! } } --- 105,112 ---- Assert.AreEqual(Adapdev.Data.DbType.SQLSERVER, ds.DatabaseType, "DataTypes don't match."); ! // foreach(ColumnSchema column in ds.GetTable("Orders").Columns.Values) ! // { ! // Console.WriteLine("{0} : {1}", column.Name, column.DataType); ! // } } *************** *** 56,60 **** { int i = 0; ! Console.WriteLine(new OleDbSchemaBuilder(null, ref i).PrintOleDbSchema(this._oledbConnectionString, OleDbSchemaGuid.Tables, "")); } --- 115,119 ---- { int i = 0; ! Console.WriteLine(new OleDbSchemaBuilder(null, ref i, this._oledbSqlServerConnectionString).PrintOleDbSchema(this._oledbSqlServerConnectionString, OleDbSchemaGuid.Tables, "")); } *************** *** 80,84 **** public void ProviderConfig() { ProviderConfig pc = new ProviderConfig(); ! Assert.AreEqual(5 ,pc.ConnectionTypes.Count, "Should have 5 Connection Types in the ProviderConfig collection"); Assert.IsTrue(pc.ConnectionTypes.Contains("Microsoft Access"),"Could not find Microsoft Access"); Assert.IsTrue(pc.ConnectionTypes.Contains("SQL Server"),"Could not find SQL Server"); --- 139,143 ---- public void ProviderConfig() { ProviderConfig pc = new ProviderConfig(); ! Assert.AreEqual(6 ,pc.ConnectionTypes.Count, "Should have 5 Connection Types in the ProviderConfig collection"); Assert.IsTrue(pc.ConnectionTypes.Contains("Microsoft Access"),"Could not find Microsoft Access"); Assert.IsTrue(pc.ConnectionTypes.Contains("SQL Server"),"Could not find SQL Server"); |