adapdev-commits Mailing List for Adapdev.NET (Page 2)
Status: Beta
Brought to you by:
intesar66
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(26) |
Apr
(59) |
May
(37) |
Jun
(53) |
Jul
(13) |
Aug
(7) |
Sep
(5) |
Oct
(74) |
Nov
(404) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(10) |
Feb
(26) |
Mar
(64) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sean M. <int...@us...> - 2006-03-18 09:59:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13506/src/Adapdev.UnitTest.Core Modified Files: RunTestIterationCommand.cs Log Message: Index: RunTestIterationCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/RunTestIterationCommand.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RunTestIterationCommand.cs 3 Mar 2006 05:22:55 -0000 1.10 --- RunTestIterationCommand.cs 18 Mar 2006 09:59:25 -0000 1.11 *************** *** 244,248 **** if(last > -1) { ! int line = exception.IndexOf("at", last); // make sure it's present --- 244,248 ---- if(last > -1) { ! int line = exception.IndexOf(" at", last); // make sure it's present |
From: Sean M. <int...@us...> - 2006-03-18 09:59:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13506/src/Adapdev.UnitTest Modified Files: Adapdev.UnitTest.csproj Log Message: Index: Adapdev.UnitTest.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest/Adapdev.UnitTest.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Adapdev.UnitTest.csproj 23 Nov 2005 03:00:42 -0000 1.9 --- Adapdev.UnitTest.csproj 18 Mar 2006 09:59:25 -0000 1.10 *************** *** 96,99 **** --- 96,104 ---- /> <File + RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Assert.cs" SubType = "Code" |
From: Sean M. <int...@us...> - 2006-03-18 09:59:27
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13506/src/Adapdev.Data.Tests Modified Files: Adapdev.Data.Tests.csproj Log Message: Index: Adapdev.Data.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Adapdev.Data.Tests.csproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Adapdev.Data.Tests.csproj 15 Mar 2006 04:34:16 -0000 1.18 --- Adapdev.Data.Tests.csproj 18 Mar 2006 09:59:24 -0000 1.19 *************** *** 18,22 **** OutputType = "Library" PreBuildEvent = "" ! PostBuildEvent = "" RootNamespace = "Adapdev.Data.Tests" RunPostBuildEvent = "OnBuildSuccess" --- 18,22 ---- OutputType = "Library" PreBuildEvent = "" ! PostBuildEvent = "copy $(ProjectDir)data\*.* $(TargetDir)" RootNamespace = "Adapdev.Data.Tests" RunPostBuildEvent = "OnBuildSuccess" |
From: Sean M. <int...@us...> - 2006-03-18 09:59:27
|
Update of /cvsroot/adapdev/Adapdev/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13506/lib Modified Files: TestDriven.Framework.dll nunit.framework.dll Log Message: Index: nunit.framework.dll =================================================================== RCS file: /cvsroot/adapdev/Adapdev/lib/nunit.framework.dll,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvsOtv6bV and /tmp/cvswoxpUN differ Index: TestDriven.Framework.dll =================================================================== RCS file: /cvsroot/adapdev/Adapdev/lib/TestDriven.Framework.dll,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 Binary files /tmp/cvsO2hagZ and /tmp/cvsfwVV2R differ |
From: Sean M. <int...@us...> - 2006-03-15 04:34:52
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SchemaBuilderTest.cs 3 Mar 2006 05:29:56 -0000 1.1 --- SchemaBuilderTest.cs 15 Mar 2006 04:34:19 -0000 1.2 *************** *** 28,32 **** 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) --- 28,32 ---- 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) |
From: Sean M. <int...@us...> - 2006-03-15 04:34:26
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/src/Adapdev.Data.Tests/Sql Modified Files: SelectQueryTest.cs Added Files: DeleteQueryTest.cs InsertQueryTest.cs SqlServerCriteriaTest.cs UpdateQueryTest.cs Log Message: --- NEW FILE: InsertQueryTest.cs --- using System; using System.Collections; using Adapdev.Data.Sql; using NUnit.Framework; namespace Adapdev.Data.Tests.Sql { /// <summary> /// Summary description for InsertQueryTest. /// </summary> /// [TestFixture] public class InsertQueryTest { private DbType _dbType = DbType.ACCESS; private string AddValues() { IInsertQuery query = QueryFactory.CreateInsertQuery(this._dbType); query.SetTable("someTable"); query.Add("dateColumn", new DateTime(2006,3,3,10,10,10,10)); query.Add("stringColumn", "some text"); query.Add("numericColumn", 12); return query.Statement; } private string AddNullValues() { IInsertQuery query = QueryFactory.CreateInsertQuery(this._dbType); query.SetTable("someTable"); query.AddNull("someColumn"); query.AddNull("someColumn2"); return query.Statement; } private string AddParameterValues() { IInsertQuery query = QueryFactory.CreateInsertQuery(this._dbType); query.SetTable("someTable"); query.Add("someColumn"); query.Add("someColumn2"); return query.Statement; } [Test] public void SqlServer() { this._dbType = DbType.SQLSERVER; Assert.AreEqual("INSERT INTO [someTable] ( [dateColumn], [stringColumn], [numericColumn] ) VALUES ( '3/3/2006 10:10:10 AM', 'some text', 12 ) ", this.AddValues(), "AddValues failed."); Assert.AreEqual("INSERT INTO [someTable] ( [someColumn], [someColumn2] ) VALUES ( NULL, NULL ) ", this.AddNullValues(), "AddNullValues failed."); Assert.AreEqual("INSERT INTO [someTable] ( [someColumn], [someColumn2] ) VALUES ( @someColumn, @someColumn2 ) ", this.AddParameterValues(), "AddParameterValues failed."); } } } Index: SelectQueryTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Sql/SelectQueryTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectQueryTest.cs 21 Jan 2006 19:42:48 -0000 1.2 --- SelectQueryTest.cs 15 Mar 2006 04:34:19 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.Collections; using Adapdev.Data.Sql; using NUnit.Framework; *************** *** 12,55 **** public class SelectQueryTest { ! [Test] ! public void CriteriaProperty() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER, DbProviderType.SQLSERVER); ! query.SetTable("SomeTable"); ! query.Add("someColumn"); ! ICriteria criteria = query.CreateCriteria(); ! criteria.AddEqualTo("someColumn", "1"); ! query.SetCriteria(criteria); ! Assert.IsNotNull(query.Criteria); ! Console.WriteLine(query.GetText()); } ! [Test] ! public void EmptyCriteria() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER); ! query.SetTable("Test"); ! query.Add("column"); ! query.SetCriteria(query.CreateCriteria()); ! Console.WriteLine(query.GetText()); } ! [Test] ! public void PopulatedCriteria() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER); ! query.SetTable("Test"); ! query.Add("column"); ! ICriteria criteria = query.CreateCriteria(); ! criteria.AddIsNull("column2"); ! query.SetCriteria(criteria); ! Console.WriteLine(query.GetText()); } } } --- 13,250 ---- public class SelectQueryTest { ! private DbType _dbType = DbType.ORACLE; ! ! ! private string SelectAll() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! return query.Statement; ! } ! private string SelectColumns() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.Add("column1"); ! query.Add("column2"); ! return query.Statement; ! } ! private string SelectColumnsWithTable() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.Add("table2", "column2"); ! query.Add("column2"); ! return query.Statement; ! } ! private string SelectColumnsWithTableAndAlias() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.Add("column1"); ! query.AddColumnAlias("table2", "column2", "alias2"); ! query.AddColumnAlias("column3", "alias3"); ! ! return query.Statement; } ! private string SelectColumnCount() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddCount("column"); ! return query.Statement; } ! private string SelectCountAll() { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddCountAll(); ! return query.Statement; ! } ! private string SelectGroupBy() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! query.AddGroupBy("column1"); ! ! return query.Statement; ! } ! ! private string SelectOrderByASC() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! query.AddOrderBy("column1"); ! ! return query.Statement; ! } ! ! private string SelectOrderByDESC() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! query.AddOrderBy("column1"); ! query.OrderBy = OrderBy.DESCENDING; ! ! return query.Statement; ! } ! ! private string SelectOrderByASCAndDESC() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! query.AddOrderBy("column1", OrderBy.DESCENDING); ! query.AddOrderBy("column2", OrderBy.ASCENDING); ! query.OrderBy = OrderBy.DESCENDING; ! ! return query.Statement; ! } ! ! ! private string SelectOrderByTableColumnASC() ! { ! ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); ! query.SetTable("sometable"); ! query.AddAll(); ! query.AddOrderBy("table1", "column1"); ! ! return query.Statement; } + + private string SelectOrderByTableColumnDESC() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddOrderBy("table1", "column1"); + query.OrderBy = OrderBy.DESCENDING; + + return query.Statement; + } + + private string SelectOrderByColumns() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddOrderByColumns("column1", "column2", "column3"); + + return query.Statement; + } + + private string SelectOrderByAndGroupBy() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddOrderBy("table1", "column1"); + query.OrderBy = OrderBy.DESCENDING; + query.AddGroupBy("column2"); + + return query.Statement; + } + + private string SelectJoin() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddJoin("table2", "column1", "column2", JoinType.INNER); + + return query.Statement; + } + + private string SelectJoinOuter() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddJoin("table2", "column1", "column2", JoinType.OUTER); + + return query.Statement; + } + + private string SelectJoinLeft() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddJoin("table2", "column1", "column2", JoinType.LEFT); + + return query.Statement; + } + + private string SelectJoinRight() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddJoin("table2", "column1", "column2", JoinType.RIGHT); + + return query.Statement; + } + + + private string SelectJoinManyToMany() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.AddJoin("table2", "column1", "column2", "table3", "column3", "table4", "column4", JoinType.INNER); + + return query.Statement; + } + + private string SelectSetLimit() + { + ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); + query.SetTable("sometable"); + query.AddAll(); + query.SetLimit(100); + + return query.Statement; + } + + + [Test] + public void SqlServer() + { + this._dbType = DbType.SQLSERVER; + + Assert.AreEqual("SELECT * FROM [sometable]", this.SelectAll(), "SelectAll failed"); + Assert.AreEqual("SELECT [column1], [column2] FROM [sometable]", this.SelectColumns(), "SelectColumns failed"); + Assert.AreEqual("SELECT [table2].[column2], [column2] FROM [sometable]", this.SelectColumnsWithTable(), "SelectColumnsWithTable failed"); + Assert.AreEqual("SELECT [column1], [table2].[column2] AS alias2, [column3] AS alias3 FROM [sometable]", this.SelectColumnsWithTableAndAlias(), "SelectColumnsWithTableAndAlias failed"); + Assert.AreEqual("SELECT COUNT([column]) FROM [sometable]", this.SelectColumnCount(), "SelectColumnCount failed"); + Assert.AreEqual("SELECT COUNT(*) FROM [sometable]", this.SelectCountAll(), "SelectCountAll failed"); + Assert.AreEqual("SELECT * FROM [sometable] GROUP BY [column1]", this.SelectGroupBy(), "SelectGroupBy failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [column1] ASC ", this.SelectOrderByASC(), "SelectOrderByASC failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [column1] DESC ", this.SelectOrderByDESC(), "SelectOrderByDESC failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [column1] DESC , [column2] ASC ", this.SelectOrderByASCAndDESC(), "SelectOrderByASCAndDESC failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [table1].[column1] ASC ", this.SelectOrderByTableColumnASC(), "SelectOrderByTableColumnASC failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [table1].[column1] DESC ", this.SelectOrderByTableColumnDESC(), "SelectOrderByTableColumnDESC failed"); + Assert.AreEqual("SELECT * FROM [sometable] ORDER BY [column1], [column2], [column3] ASC ", this.SelectOrderByColumns(), "SelectOrderByColumns failed"); + Assert.AreEqual("SELECT * FROM [sometable] GROUP BY [column2] ORDER BY [table1].[column1] DESC ", this.SelectOrderByAndGroupBy(), "SelectOrderByAndGroupBy failed"); + Assert.AreEqual("SELECT * FROM [sometable] INNER JOIN [table2] ON [sometable].[column1] = [table2].[column2] ", this.SelectJoin(), "SelectJoin failed"); + Assert.AreEqual("SELECT * FROM [sometable] INNER JOIN [table2] ON [sometable].[column1] = [table2].[column2] INNER JOIN [table4] ON [table3].[column3] = [table4].[column4] ", this.SelectJoinManyToMany(), "SelectJoinManyToMany failed"); + Assert.AreEqual("SELECT * FROM [sometable] FULL OUTER JOIN [table2] ON [sometable].[column1] = [table2].[column2] ", this.SelectJoinOuter(), "SelectJoinOuter failed"); + Assert.AreEqual("SELECT * FROM [sometable] LEFT OUTER JOIN [table2] ON [sometable].[column1] = [table2].[column2] ", this.SelectJoinLeft(), "SelectJoinLeft failed"); + Assert.AreEqual("SELECT * FROM [sometable] RIGHT OUTER JOIN [table2] ON [sometable].[column1] = [table2].[column2] ", this.SelectJoinRight(), "SelectJoinRight failed"); + Console.WriteLine(this.SelectGroupBy()); + } + } } --- NEW FILE: DeleteQueryTest.cs --- using System; using System.Collections; using Adapdev.Data.Sql; using NUnit.Framework; namespace Adapdev.Data.Tests.Sql { /// <summary> /// Summary description for DeleteQueryTest. /// </summary> /// [TestFixture] public class DeleteQueryTest { private DbType _dbType = DbType.ACCESS; private string Delete() { IDeleteQuery query = QueryFactory.CreateDeleteQuery(this._dbType); query.SetTable("someTable"); return query.Statement; } [Test] public void SqlServer() { this._dbType = DbType.SQLSERVER; Assert.AreEqual("DELETE FROM [someTable]", this.Delete(), "Delete failed."); } } } --- NEW FILE: UpdateQueryTest.cs --- using System; using System.Collections; using Adapdev.Data.Sql; using NUnit.Framework; namespace Adapdev.Data.Tests.Sql { /// <summary> /// Summary description for UpdateQueryTest. /// </summary> /// [TestFixture] public class UpdateQueryTest { private DbType _dbType = DbType.SQLSERVER; private string AddValues() { IUpdateQuery query = QueryFactory.CreateUpdateQuery(this._dbType); query.SetTable("someTable"); query.Add("dateColumn", new DateTime(2006,3,3,10,10,10,10)); query.Add("stringColumn", "some text"); query.Add("numericColumn", 12); return query.Statement; } private string AddNullValues() { IUpdateQuery query = QueryFactory.CreateUpdateQuery(this._dbType); query.SetTable("someTable"); query.AddNull("someColumn"); query.AddNull("someColumn2"); return query.Statement; } private string AddParameterValues() { IUpdateQuery query = QueryFactory.CreateUpdateQuery(this._dbType); query.SetTable("someTable"); query.Add("someColumn"); query.Add("someColumn2"); return query.Statement; } [Test] public void SqlServer() { this._dbType = DbType.SQLSERVER; Assert.AreEqual("UPDATE [someTable] SET [dateColumn] = '3/3/2006 10:10:10 AM', [stringColumn] = 'some text', [numericColumn] = 12", this.AddValues(), "AddValues failed."); Assert.AreEqual("UPDATE [someTable] SET [someColumn] = NULL, [someColumn2] = NULL", this.AddNullValues(), "AddNullValues failed."); Assert.AreEqual("UPDATE [someTable] SET [someColumn] = @someColumn, [someColumn2] = @someColumn2", this.AddParameterValues(), "AddParameterValues failed."); } } } --- NEW FILE: SqlServerCriteriaTest.cs --- using System; using System.Collections; using Adapdev.Data.Sql; using NUnit.Framework; namespace Adapdev.Data.Tests.Sql { /// <summary> /// Summary description for SqlServerCriteriaTest. /// </summary> /// [TestFixture] public class SqlServerCriteriaTest { private DbType _dbType = DbType.SQLSERVER; [Test] public void AddAnd() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddBetween("column1", 1, 5); criteria.AddAnd(); criteria.AddGreaterThan("column2", 2); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] BETWEEN 1 AND 5 AND [column2] > 2 ", criteria.GetText()); } [Test] public void AddOr() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddBetween("column1", 1, 5); criteria.AddOr(); criteria.AddGreaterThan("column2", 2); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] BETWEEN 1 AND 5 OR [column2] > 2 ", criteria.GetText()); } [Test] public void AddBetweenNumbers() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddBetween("column1", 1, 5); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] BETWEEN 1 AND 5 ", criteria.GetText()); } [Test] public void AddBetweenDates() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddBetween("column1", new DateTime(2006,3,3,10,10,10,10), new DateTime(2006,4,3,10,10,10,10)); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] BETWEEN '3/3/2006 10:10:10 AM' AND '4/3/2006 10:10:10 AM' ", criteria.GetText()); } [Test] public void AddNotBetweenNumbers() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotBetween("column1", 1, 5); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] NOT BETWEEN 1 AND 5 ", criteria.GetText()); } [Test] public void AddEqualToNumber() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] = 1 ", criteria.GetText()); } [Test] public void AddEqualToDate() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("column1", new DateTime(2006,3,3,10,10,10,10)); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] = '3/3/2006 10:10:10 AM' ", criteria.GetText()); } [Test] public void AddEqualToText() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("column1", "some text"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] = 'some text' ", criteria.GetText()); } [Test] public void AddNotEqualToText() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotEqualTo("column1", "some text"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] <> 'some text' ", criteria.GetText()); } [Test] public void AddEqualToWithTableNumber() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("table1", "column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] = 1 ", criteria.GetText()); } [Test] public void AddEqualToWithTableDate() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("table1", "column1", new DateTime(2006,3,3,10,10,10,10)); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] = '3/3/2006 10:10:10 AM' ", criteria.GetText()); } [Test] public void AddEqualToWithTableText() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("table1", "column1", "some text"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] = 'some text' ", criteria.GetText()); } [Test] public void AddEqualToWithParameter() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddEqualTo("column1"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] = @column1 ", criteria.GetText()); } [Test] public void AddExists() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("someTable"); query.Add("column1"); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddExists(query); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE EXISTS (SELECT [column1] FROM [someTable]) ", criteria.GetText()); } [Test] public void AddNotExists() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("someTable"); query.Add("column1"); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotExists(query); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE NOT EXISTS (SELECT [column1] FROM [someTable]) ", criteria.GetText()); } [Test] public void AddGreaterThan() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddGreaterThan("column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] > 1 ", criteria.GetText()); } [Test] public void AddGreaterThanOrEqualTo() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddGreaterThanOrEqualTo("column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] >= 1 ", criteria.GetText()); } [Test] public void AddInUsingSubquery() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("someTable"); query.Add("column1"); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddIn("column1", query); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] IN (SELECT [column1] FROM [someTable]) ", criteria.GetText()); } [Test] public void AddNotInUsingSubquery() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("someTable"); query.Add("column1"); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotIn("column1", query); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] NOT IN (SELECT [column1] FROM [someTable]) ", criteria.GetText()); } [Test] public void AddInUsingCollection() { ArrayList al = new ArrayList(); al.Add(1); al.Add(2); al.Add(3); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddIn("column1", al); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] IN (1, 2, 3) ", criteria.GetText()); } [Test] public void AddNotInUsingCollection() { ArrayList al = new ArrayList(); al.Add(1); al.Add(2); al.Add(3); ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotIn("column1", al); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] NOT IN (1, 2, 3)", criteria.GetText()); } [Test] public void AddIsNull() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddIsNull("column1"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] IS NULL ", criteria.GetText()); } [Test] public void AddNotNull() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotNull("column1"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] IS NOT NULL ", criteria.GetText()); } [Test] public void AddAndCriteria() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotNull("column1"); ICriteria criteria2 = CriteriaFactory.CreateCriteria(this._dbType); criteria2.AddNotNull("column1"); criteria2.AddAndCriteria(criteria); Console.WriteLine(criteria2.GetText()); Assert.AreEqual(" WHERE [column1] IS NOT NULL AND ( [column1] IS NOT NULL ) ", criteria2.GetText()); } [Test] public void AddOrCriteria() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotNull("column1"); ICriteria criteria2 = CriteriaFactory.CreateCriteria(this._dbType); criteria2.AddNotNull("column1"); criteria2.AddOrCriteria(criteria); Console.WriteLine(criteria2.GetText()); Assert.AreEqual(" WHERE [column1] IS NOT NULL OR ( [column1] IS NOT NULL ) ", criteria2.GetText()); } [Test] public void AddSql() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotNull("column1"); criteria.AddSql("SELECT * FROM table2"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] IS NOT NULL SELECT * FROM table2 ", criteria.GetText()); } [Test] public void AddLessThan() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLessThan("column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] < 1 ", criteria.GetText()); } [Test] public void AddLessThanOrEqualTo() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLessThanOrEqualTo("column1", 1); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] <= 1 ", criteria.GetText()); } [Test] public void AddLike() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLike("column1", "%country"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] LIKE '%country' ", criteria.GetText()); } [Test] public void AddNotLike() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddNotLike("column1", "%country"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [column1] NOT LIKE '%country' ", criteria.GetText()); } [Test] public void AddLikeWithTable() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLike("table1", "column1", "%country"); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] LIKE '%country' ", criteria.GetText()); } [Test] public void AddAndWithCriteria() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLike("table1", "column1", "%country"); ICriteria criteria2 = CriteriaFactory.CreateCriteria(this._dbType); criteria2.AddEqualTo("column2", 2); criteria.AddAndCriteria(criteria2); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] LIKE '%country' AND ([column2] = 2) ", criteria.GetText()); } [Test] public void AddOrWithCriteria() { ICriteria criteria = CriteriaFactory.CreateCriteria(this._dbType); criteria.AddLike("table1", "column1", "%country"); ICriteria criteria2 = CriteriaFactory.CreateCriteria(this._dbType); criteria2.AddEqualTo("column2", 2); criteria.AddOrCriteria(criteria2); Console.WriteLine(criteria.GetText()); Assert.AreEqual(" WHERE [table1].[column1] LIKE '%country' OR ([column2] = 2) ", criteria.GetText()); } [Test] public void CriteriaProperty() { ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER, DbProviderType.SQLSERVER); query.SetTable("SomeTable"); query.Add("someColumn"); ICriteria criteria = query.CreateCriteria(); criteria.AddEqualTo("someColumn", "1"); query.SetCriteria(criteria); Assert.IsNotNull(query.Criteria); Console.WriteLine(query.GetText()); } [Test] public void EmptyCriteria() { ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER); query.SetTable("Test"); query.Add("column"); query.SetCriteria(query.CreateCriteria()); Console.WriteLine(query.GetText()); } [Test] public void PopulatedCriteria() { ISelectQuery query = QueryFactory.CreateSelectQuery(DbType.SQLSERVER); query.SetTable("Test"); query.Add("column"); ICriteria criteria = query.CreateCriteria(); criteria.AddIsNull("column2"); query.SetCriteria(criteria); Console.WriteLine(query.GetText()); } } } |
From: Sean M. <int...@us...> - 2006-03-15 04:34:26
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/src/Adapdev.Tests/XPath Modified Files: XPathObjectNavigatorTest.cs Log Message: Index: XPathObjectNavigatorTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/XPath/XPathObjectNavigatorTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XPathObjectNavigatorTest.cs 21 Feb 2006 04:31:17 -0000 1.6 --- XPathObjectNavigatorTest.cs 15 Mar 2006 04:34:20 -0000 1.7 *************** *** 71,74 **** --- 71,104 ---- [Test] + public void TestIListIteration() + { + Product p1 = new Product("egg"); + Product p2 = new Product("Monty Python Flying Circus Box"); + p2.Categories.Add("Silly Stuff"); + + Customer c1 = new Customer("Rodrigo", "Oliveira", new Address("Al. Ribeir�o Preto", 487)); + Customer c2 = new Customer("Marcia", "Longo", new Address("Al. Ribeir�o Preto", 487)); + + Order o1 = new Order(c1); + o1.Add(new OrderItem(p1, 10)); + o1.Add(new OrderItem(p2, 1)); + + Order o2 = new Order(c2); + o2.Add(new OrderItem(p1, 15)); + o2.Add(new OrderItem(p2, 1)); + + Order[] orders = new Order[] { o1, o2 }; + + XPathObjectNavigator navigator = new XPathObjectNavigator(orders, "Orders"); + object[] i = navigator.SelectObjects("//Customer"); + Assert.AreEqual(2, i.Length); + foreach(Customer c in i) + { + Console.WriteLine(c.FirstName); + } + + } + + [Test] public void TestIListProperties() { |
From: Sean M. <int...@us...> - 2006-03-15 04:34:25
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/src/Adapdev.Data.Tests Modified Files: Adapdev.Data.Tests.csproj SelectQueryTest.cs Log Message: Index: SelectQueryTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/SelectQueryTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SelectQueryTest.cs 3 Mar 2006 05:29:55 -0000 1.1 --- SelectQueryTest.cs 15 Mar 2006 04:34:16 -0000 1.2 *************** *** 13,104 **** public class SelectQueryTest { - private DbType _dbType = DbType.ACCESS; - private Hashtable q = new Hashtable(); - - public SelectQueryTest() - { - q.Add("SQLSERVER_SelectAll", ""); - } - - private string SelectAll() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.AddAll(); - return query.Statement; - } - - private string SelectColumns() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.Add("column1"); - query.Add("column2"); - return query.Statement; - } - - private string SelectColumnsWithTable() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.Add("table2", "column2"); - query.Add("column2"); - return query.Statement; - } - - private string SelectColumnsWithTableAndAlias() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.Add("column1"); - query.AddColumnAlias("table2", "column2", "alias2"); - query.AddColumnAlias("column3", "alias3"); - - return query.Statement; - } - - private string SelectColumnCount() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.AddCount("column"); - - return query.Statement; - } - - private string SelectCountAll() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.AddCountAll(); - - return query.Statement; - } - - private string SelectGroupBy() - { - ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); - query.SetTable("sometable"); - query.AddAll(); - query.AddGroupBy("column1"); - - return query.Statement; - } - - - [Test] - public void SqlServer() - { - this._dbType = DbType.SQLSERVER; - - Assert.AreEqual("SELECT * FROM [sometable]", this.SelectAll(), "SelectAll failed"); - Assert.AreEqual("SELECT [column1], [column2] FROM [sometable]", this.SelectColumns(), "SelectColumns failed"); - Assert.AreEqual("SELECT [table2].[column2], [column2] FROM [sometable]", this.SelectColumnsWithTable(), "SelectColumnsWithTable failed"); - Assert.AreEqual("SELECT [column1], [table2].[column2] AS alias2, [column3] AS alias3 FROM [sometable]", this.SelectColumnsWithTableAndAlias(), "SelectColumnsWithTableAndAlias failed"); - Assert.AreEqual("SELECT COUNT([column]) FROM [sometable]", this.SelectColumnCount(), "SelectColumnCount failed"); - Assert.AreEqual("SELECT COUNT(*) FROM [sometable]", this.SelectCountAll(), "SelectCountAll failed"); - Assert.AreEqual("SELECT * FROM [sometable] GROUP BY [column1]", this.SelectGroupBy(), "SelectGroupBy failed"); - Console.WriteLine(this.SelectGroupBy()); - } } } --- 13,16 ---- Index: Adapdev.Data.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Adapdev.Data.Tests.csproj,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Adapdev.Data.Tests.csproj 3 Mar 2006 05:22:54 -0000 1.17 --- Adapdev.Data.Tests.csproj 15 Mar 2006 04:34:16 -0000 1.18 *************** *** 135,143 **** BuildAction = "Compile" /> - <File - RelPath = "SelectQueryTest.cs" - SubType = "Code" - BuildAction = "Compile" - /> <Folder RelPath = "bin\Debug\" /> <File --- 135,138 ---- *************** *** 202,209 **** --- 197,224 ---- /> <File + RelPath = "Sql\DeleteQueryTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\InsertQueryTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Sql\SelectQueryTest.cs" SubType = "Code" BuildAction = "Compile" /> + <File + RelPath = "Sql\SqlServerCriteriaTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Sql\UpdateQueryTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> |
From: Sean M. <int...@us...> - 2006-03-15 04:34:25
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/src/Adapdev.Data/Schema Modified Files: ColumnSchema.cs OleDbSchemaBuilder.cs Log Message: Index: ColumnSchema.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/ColumnSchema.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ColumnSchema.cs 19 Jan 2006 03:50:40 -0000 1.15 --- ColumnSchema.cs 15 Mar 2006 04:34:20 -0000 1.16 *************** *** 32,35 **** --- 32,37 ---- private string _defaultValue = String.Empty; private string _defaultTestValue = String.Empty; + private string _numericPrecision = String.Empty; + private string _numericScale = String.Empty; private ArrayList _fkReferences = new ArrayList(); *************** *** 278,281 **** --- 280,299 ---- } + [XmlAttribute] + [SchemaDataRewritableAttribute(true)] + public string NumericPrecision + { + get { return _numericPrecision; } + set { _numericPrecision = value; } + } + + [XmlAttribute] + [SchemaDataRewritableAttribute(true)] + public string NumericScale + { + get { return _numericScale; } + set { _numericScale = value; } + } + public string GetMySqlDbTypeName() { Index: OleDbSchemaBuilder.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/OleDbSchemaBuilder.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** OleDbSchemaBuilder.cs 8 Feb 2006 03:00:00 -0000 1.9 --- OleDbSchemaBuilder.cs 15 Mar 2006 04:34:20 -0000 1.10 *************** *** 186,189 **** --- 186,191 ---- ci.Ordinal = (int) dr["ColumnOrdinal"]; ci.IsReadOnly = (bool) dr["IsReadOnly"]; + ci.NumericPrecision = dr["NumericPrecision"] as string; + ci.NumericScale = dr["NumericScale"] as string; ts.AddColumn(ci); } |
From: Sean M. <int...@us...> - 2006-03-15 04:34:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/src/Adapdev.Data/Sql Modified Files: Criteria.cs ICriteria.cs ISelectQuery.cs SelectQuery.cs Log Message: Index: Criteria.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/Criteria.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Criteria.cs 21 Jan 2006 19:42:48 -0000 1.8 --- Criteria.cs 15 Mar 2006 04:34:20 -0000 1.9 *************** *** 40,44 **** this.AddAnd(); sb.Append("("); ! sb.Append(c.GetText().Replace("WHERE","")); sb.Append(") "); this.initialized = true; --- 40,44 ---- this.AddAnd(); sb.Append("("); ! sb.Append(c.GetText().Replace("WHERE","").Trim()); sb.Append(") "); this.initialized = true; *************** *** 46,50 **** } ! public virtual void AddCriteriaSeparator(CriteriaType ct) { if (ct == CriteriaType.AND) sb.Append(" AND "); --- 46,50 ---- } ! protected void AddCriteriaSeparator(CriteriaType ct) { if (ct == CriteriaType.AND) sb.Append(" AND "); *************** *** 108,111 **** --- 108,113 ---- public virtual void AddExists(ISqlQuery subSqlQuery) { + sb.Append(" EXISTS (" + subSqlQuery.Statement + ") "); + this.initialized = true; } *************** *** 136,139 **** --- 138,145 ---- public virtual void AddIn(string columnName, ISqlQuery subSqlQuery) { + sb.Append(" "); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); + sb.Append(columnName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); sb.Append(" IN ("); sb.Append(subSqlQuery.GetText()); *************** *** 145,149 **** --- 151,158 ---- { StringBuilder sbo = new StringBuilder(); + sb.Append(" "); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); sb.Append(columnName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); sb.Append(" IN ("); IEnumerator enumerator = values.GetEnumerator(); *************** *** 203,206 **** --- 212,231 ---- } + public virtual void AddLike(string tableName, string columnName, object columnValue) + { + sb.Append(" "); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); + sb.Append(tableName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); + sb.Append("."); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); + sb.Append(columnName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); + sb.Append(" LIKE "); + sb.Append(QueryHelper.DressUp(columnValue,this.type)); + sb.Append(" "); + this.initialized = true; + } + public virtual void AddNotBetween(string columnName, object value1, object value2) { *************** *** 231,235 **** public virtual void AddNotExists(ISqlQuery subSqlQuery) { ! sb.Append(" EXISTS (" + subSqlQuery.GetText() + ") "); this.initialized = true; } --- 256,260 ---- public virtual void AddNotExists(ISqlQuery subSqlQuery) { ! sb.Append(" NOT EXISTS (" + subSqlQuery.GetText() + ") "); this.initialized = true; } *************** *** 238,241 **** --- 263,270 ---- { StringBuilder sbo = new StringBuilder(); + sb.Append(" "); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); + sb.Append(columnName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); sb.Append(" NOT IN ("); IEnumerator enumerator = values.GetEnumerator(); *************** *** 251,254 **** --- 280,288 ---- public virtual void AddNotIn(string columnName, ISqlQuery subSqlQuery) { + sb.Append(" "); + sb.Append(QueryHelper.GetPreDelimeter(this.type)); + sb.Append(columnName); + sb.Append(QueryHelper.GetPostDelimeter(this.type)); + sb.Append(" NOT IN (" + subSqlQuery.GetText() + ") "); this.initialized = true; *************** *** 273,277 **** sb.Append(columnName); sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" NOT IS NULL "); this.initialized = true; } --- 307,311 ---- sb.Append(columnName); sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" IS NOT NULL "); this.initialized = true; } *************** *** 287,291 **** { this.AddOr(); ! sb.Append("(" + c.GetText().Replace("WHERE","") + ")"); this.initialized = true; } --- 321,325 ---- { this.AddOr(); ! sb.Append("(" + c.GetText().Replace("WHERE","").Trim() + ") "); this.initialized = true; } *************** *** 294,298 **** --- 328,334 ---- public virtual void AddSql(string sql) { + sb.Append(" "); sb.Append(sql); + sb.Append(" "); this.initialized = true; } *************** *** 321,324 **** --- 357,365 ---- } + public string Statement + { + get{return this.GetText();} + } + } Index: SelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/SelectQuery.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SelectQuery.cs 3 Mar 2006 05:22:54 -0000 1.13 --- SelectQuery.cs 15 Mar 2006 04:34:20 -0000 1.14 *************** *** 18,21 **** --- 18,22 ---- protected int maxRecords = 0; protected string _join = ""; + private bool orderSet = false; internal SelectQuery(DbType type, DbProviderType provider) *************** *** 103,106 **** --- 104,113 ---- } + public void AddOrderBy(string columnName, OrderBy orderBy) + { + order.Enqueue(QueryHelper.GetPreDelimeter(this.type) + columnName + QueryHelper.GetPostDelimeter(this.type) + " " + this.TranslateOrderBy(orderBy)); + this.orderSet = true; + } + public void AddOrderBy(string tableName, string columnName) { *************** *** 108,111 **** --- 115,124 ---- } + public void AddOrderBy(string tableName, string columnName, OrderBy orderBy) + { + order.Enqueue(QueryHelper.GetPreDelimeter(this.type) + tableName + QueryHelper.GetPostDelimeter(this.type) + "." + QueryHelper.GetPreDelimeter(this.type) + columnName + QueryHelper.GetPostDelimeter(this.type) + " " + this.TranslateOrderBy(orderBy)); + this.orderSet = true; + } + public void AddOrderBy(string tableName, params string[] columns) { *************** *** 116,120 **** } ! public void AddOrderBy(params string[] columns) { foreach (string s in columns) --- 129,133 ---- } ! public void AddOrderByColumns(params string[] columns) { foreach (string s in columns) *************** *** 141,145 **** this._join = String.Format(" {0} {1} ON {2}.{3} = {4}.{5} ", this.GetJoinType(type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! QueryHelper.GetPreDelimeter(this.type) + this._table + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + firstTableColumn + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), --- 154,158 ---- this._join = String.Format(" {0} {1} ON {2}.{3} = {4}.{5} ", this.GetJoinType(type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! this._table, QueryHelper.GetPreDelimeter(this.type) + firstTableColumn + QueryHelper.GetPostDelimeter(this.type), QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), *************** *** 173,177 **** public virtual string GetText() { ! return "SELECT " + this.GetLimit() + this.GetColumns() + " FROM " + this._table + this._join + this.GetCriteria() + this.GetOrderBy() + this.GetGroupBy(); } --- 186,190 ---- public virtual string GetText() { ! return "SELECT " + this.GetLimit() + this.GetColumns() + " FROM " + this._table + this._join + this.GetCriteria() + this.GetGroupBy() + this.GetOrderBy(); } *************** *** 271,274 **** --- 284,289 ---- case JoinType.RIGHT: return "RIGHT OUTER JOIN"; + case JoinType.OUTER: + return "FULL OUTER JOIN"; default: throw new Exception("JoinType " + type + " not supported."); *************** *** 278,282 **** protected virtual string TranslateOrderBy() { ! if (this.ob == OrderBy.DESCENDING) { return " DESC "; --- 293,305 ---- protected virtual string TranslateOrderBy() { ! if(!this.orderSet) ! return this.TranslateOrderBy(this.ob); ! else ! return String.Empty; ! } ! ! protected virtual string TranslateOrderBy(OrderBy orderBy) ! { ! if (orderBy == OrderBy.DESCENDING) { return " DESC "; Index: ICriteria.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/ICriteria.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ICriteria.cs 21 Jan 2006 19:42:48 -0000 1.8 --- ICriteria.cs 15 Mar 2006 04:34:20 -0000 1.9 *************** *** 10,14 **** void AddAnd(); void AddAndCriteria(ICriteria pc); - void AddCriteriaSeparator(CriteriaType ct); void AddBetween(string columnName, object value1, object value2); void AddEqualTo(string columnName, object columnValue); --- 10,13 ---- *************** *** 24,27 **** --- 23,27 ---- void AddLessThan(string columnName, object columnValue); void AddLike(string columnName, object columnValue); + void AddLike(string tableName, string columnName, object columnValue); void AddNotBetween(string columnName, object value1, object value2); void AddNotEqualTo(string columnName, object columnValue); *************** *** 34,37 **** --- 34,38 ---- void AddOrCriteria(ICriteria pc); void AddSql(string sql); + string Statement{get;} string GetText(); bool Initialized{get;} Index: ISelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/ISelectQuery.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ISelectQuery.cs 21 Jan 2006 19:42:48 -0000 1.10 --- ISelectQuery.cs 15 Mar 2006 04:34:20 -0000 1.11 *************** *** 50,53 **** --- 50,59 ---- void AddOrderBy(string columnName); /// <summary> + /// Adds a ORDER BY [columnName] statement in the datastore specific format + /// </summary> + /// <param name="columnName">Name of the column.</param> + /// <param name="orderBy">The order by.</param> + void AddOrderBy(string columnName, OrderBy orderBy); + /// <summary> /// Adds a ORDER BY [table].[column] statement in the datastore specific format /// </summary> *************** *** 56,63 **** void AddOrderBy(string tableName, string columnName); /// <summary> /// Adds a ORDER BY [column1], [column2]... statement in the datastore specific format /// </summary> /// <param name="columns"></param> ! void AddOrderBy(params string[] columns); /// <summary> /// Adds a GROUP BY [columnName] statement in the datastore specific format --- 62,76 ---- void AddOrderBy(string tableName, string columnName); /// <summary> + /// Adds a ORDER BY [table].[column] statement in the datastore specific format + /// </summary> + /// <param name="tableName"></param> + /// <param name="columnName"></param> + /// <param name="orderBy">The order by.</param> + void AddOrderBy(string tableName, string columnName, OrderBy orderBy); + /// <summary> /// Adds a ORDER BY [column1], [column2]... statement in the datastore specific format /// </summary> /// <param name="columns"></param> ! void AddOrderByColumns(params string[] columns); /// <summary> /// Adds a GROUP BY [columnName] statement in the datastore specific format *************** *** 98,102 **** LEFT, RIGHT, ! INNER } } \ No newline at end of file --- 111,116 ---- LEFT, RIGHT, ! INNER, ! OUTER } } \ No newline at end of file |
From: Sean M. <int...@us...> - 2006-03-15 04:34:21
|
Update of /cvsroot/adapdev/Adapdev/lib/nunit/226 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16961/lib/nunit/226 Added Files: nunit.framework.dll Log Message: --- NEW FILE: nunit.framework.dll --- (This appears to be a binary file; contents omitted.) |
From: Sean M. <int...@us...> - 2006-03-03 05:30:04
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev/Collections Added Files: CollectionSorter.cs SortableCollectionBase.cs Log Message: --- NEW FILE: CollectionSorter.cs --- // Original Copyright (c) 2003 Diego Mijelshon. http://www.codeproject.com/csharp/objectcomparer.asp #region Modified Copyright / License Information /* Copyright 2004 - 2005 Adapdev Technologies, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============================ Author Log ============================ III Full Name SMM Sean McCormack (Adapdev) ============================ Change Log ============================ III MMDDYY Change */ #endregion using System; using System.Collections; using System.Reflection; namespace Adapdev.Collections { [Serializable] public class CollectionSorter : IComparer { #region methods /// <summary> /// Compares two objects and returns a value indicating whether one is less than, equal to or greater than the other. /// </summary> /// <param name="x">First object to compare.</param> /// <param name="y">Second object to compare.</param> /// <returns></returns> public int Compare(object x, object y) { //Get types of the objects Type typex = x.GetType(); Type typey = y.GetType(); for(int i = 0; i<Fields.Length; i++) { //Get each property by name PropertyInfo pix = typex.GetProperty(Fields[i]); PropertyInfo piy = typey.GetProperty(Fields[i]); //Get the value of the property for each object IComparable pvalx = (IComparable)pix.GetValue(x, null); object pvaly = piy.GetValue(y, null); //Compare values, using IComparable interface of the property's type int iResult = pvalx.CompareTo(pvaly); if (iResult != 0) { //Return if not equal if (Descending[i]) { //Invert order return -iResult; } else { return iResult; } } } //Objects have the same sort order return 0; } #endregion #region constructors /// <summary> /// Create a comparer for objects of arbitrary types having using the specified properties /// </summary> /// <param name="fields">Properties to sort objects by</param> public CollectionSorter(params string[] fields) : this(fields, new bool[fields.Length]) {} /// <summary> /// Create a comparer for objects of arbitrary types having using the specified properties and sort order /// </summary> /// <param name="fields">Properties to sort objects by</param> /// <param name="descending">Properties to sort in descending order</param> public CollectionSorter(string[] fields, bool[] descending) { Fields = fields; Descending = descending; } #endregion #region protected fields /// <summary> /// Properties to sort objects by /// </summary> protected string[] Fields; /// <summary> /// Properties to sort in descending order /// </summary> protected bool[] Descending; #endregion } } --- NEW FILE: SortableCollectionBase.cs --- // Copyright 2004 J. Ambrose - http://dotnettemplar.net/PermaLink.aspx?guid=1d32654f-9ed5-46e2-a815-4f70b762f734 using System; using System.Reflection; using System.CodeDom.Compiler; using Microsoft.CSharp; namespace Adapdev.Collections { /// <summary> /// Base class that provides T-SQL-like sorting capabilities. /// </summary> /// <remarks>This class is not thread safe; it depends on the /// underlying collection to remain static during sorting /// operations, therefore, use the <see cref="GetNewView"/> /// methods to get a shallow copy of the collection before /// attempting sort operations if the collection instance /// could be accessed by more than one thread in your /// application.</remarks> public class SortableCollectionBase : System.Collections.CollectionBase { #region Static Caches /// <summary> /// Comparer cache that stores instances of dynamically-created comparers. /// </summary> protected static System.Collections.Hashtable comparers = new System.Collections.Hashtable(100); /// <summary> /// Table for ensuring that we only generate a unique comparer once. /// </summary> protected static System.Collections.Hashtable comparerLocks = new System.Collections.Hashtable(10); /// <summary> /// Assembly path cache that stores the paths to the referenced assemblies /// to be used when compiling dynamically-created comparers. /// </summary> protected static System.Collections.Hashtable assemblyPaths = new System.Collections.Hashtable(10); #endregion #region GetNewView /// <summary> /// Gets a new <see cref="SortableCollectionBase"/> to /// provide a unique view of the underlying collection. /// </summary> /// <overload>Gets a view of the current collection.</overload> /// <returns>A new view of the underlying collection.</returns> /// <remarks>This would typically be used when needing to modify /// the collection for display purposes, such as sorting and the like. /// <p>It performs a shallow copy of the collection.</p></remarks> public SortableCollectionBase GetNewView() { SortableCollectionBase view = new SortableCollectionBase(); for (int i = 0; i < this.List.Count; i++) { view.List.Add(this.List[i]); } return view; } /// <summary> /// Gets a view of the current collection as /// the collection type specified. /// </summary> /// <overload>Gets a view of the current collection.</overload> /// <param name="collectionType">The type of collection to return.</param> /// <returns>A collection of the specified <i>collectionType</i> /// that contains a shallow copy of the items in this collection.</returns> /// <remarks> /// Constraints: A <see cref="NotSupportedException"/> will /// be thrown if any are not met. /// <ul> /// <li>The <i>collectionType</i> must implement a /// default constructor ("new" constraint).</li> /// <li>The <i>collectionType</i> must implement the /// <see cref="System.Collections.IList"/> interface.</li> /// </ul> /// </remarks> public System.Collections.IList GetNewView(System.Type collectionType) { return this.GetNewView(collectionType, null); } /// <summary> /// Gets a view of the current collection, sorted using the given <i>sortExpression</i>. /// </summary> /// <overload>Gets a view of the current collection.</overload> /// <param name="collectionType">The type of collection to return.</param> /// <param name="sortExpression"></param> /// <returns>A collection of the specified <i>collectionType</i> /// that contains a shallow copy of the items in this collection.</returns> /// <remarks> /// Constraints: A <see cref="NotSupportedException"/> will /// be thrown if any are not met. /// <ul> /// <li>The <i>collectionType</i> must implement a /// default constructor ("new" constraint).</li> /// <li>The <i>collectionType</i> must inherit from the /// <see cref="SortableCollectionBase"/> class.</li> /// </ul> /// </remarks> public System.Collections.IList GetNewView(System.Type collectionType, string sortExpression) { System.Reflection.ConstructorInfo ctor; // retrieve the property info for the specified property ctor = collectionType.GetConstructor(new System.Type[0]); if (ctor == null) throw new NotSupportedException( String.Format("The '{0}' type must have a public default constructor.", collectionType.FullName)); // get an instance of the collection type SortableCollectionBase view = ctor.Invoke(new object[] {}) as SortableCollectionBase; if (view == null) throw new NotSupportedException( String.Format("The '{0}' type must inherit from SortableCollectionBase.", collectionType.FullName)); for (int i = 0; i < this.List.Count; i++) view.InnerList.Add(base.List[i]); if (sortExpression != null) view.Sort(sortExpression); return view; } #endregion #region Sort /// <summary> /// Sorts the list by the given expression. /// </summary> /// <param name="sortExpression">A sort expression, e.g., MyProperty ASC, MyProp2 DESC.</param> /// <remarks> /// Valid sort expressions are comma-delimited lists of properties where each property /// can optionally be followed by a sort direction (ASC or DESC).<br /> /// Sort order is from left to right, i.e., properties to the left are sorted on first. /// <p>All properties sorted on must implement <see cref="IComparable"/> and meaningfully /// override <see cref="Object.Equals"/>.</p> /// <p>If <i>sortExpression</i> is null, an <see cref="ArgumentNullException"/> is thrown.<br /> /// If <i>sortExpression</i> is empty, an <see cref="ArgumentException"/> is thrown.<br /> /// Throws an <see cref="ApplicationException"/> if there are errors compiling the comparer /// or if a new instance of a dynamically-created comparer cannot be created /// for any of the sort properties.</p> /// <p>It is assumed that all objects in the collection are of the same type.</p> /// </remarks> public void Sort(string sortExpression) { #region Parameter Checks if (sortExpression == null) throw new ArgumentNullException("sortExpression", "Argument cannot be null."); #endregion this.InnerList.Sort(this.GetMultiComparer(this.List[0].GetType(), sortExpression)); } /// <summary> /// Gets an <see cref="System.Collections.IComparer"/> for the given type and sort expression. /// </summary> /// <param name="type">The type of object to be sorted.</param> /// <param name="sortExpression">A sort expression, e.g., MyProperty ASC, MyProp2 DESC.</param> /// <returns>An <see cref="System.Collections.IComparer"/> for the given type and sort expression.</returns> protected System.Collections.IComparer GetMultiComparer(System.Type type, string sortExpression) { // split the sort expression string by the commas string[] sorts = sortExpression.Split(','); // if no sorts are present, throw an exception if (sorts.Length == 0) throw new ArgumentException("No sorts were passed in the sort expression.", "sortExpression"); string typeName = type.FullName; // create a unique type name for the comparer based on the type and sort expression string comparerName = sortExpression.Replace(",", "").Replace(" ", "") + "Comparer", dynamicTypeName = typeName + "DynamicComparers." + comparerName; System.Collections.IComparer comparer = null; // check the comparers table for an existing comparer for this type and property if (!comparers.ContainsKey(dynamicTypeName)) // not found { object comparerLock; bool generate = false; // let threads pile up here waiting their turn to look at this collection lock (comparerLocks.SyncRoot) { // First, we see if the comparer lock for this // dynamicTypeName exists. comparerLock = comparerLocks[dynamicTypeName]; if (comparerLock == null) { // This is the first thread in here looking for this // dynamicTypeName, so it gets to be the one to // create the comparer for the dynamicTypeName. generate = true; // Add lock object for any future threads to see and // know that they won't need to generate the comparer. comparerLock = new object(); comparerLocks.Add(dynamicTypeName, comparerLock); } } // comparerLock will be unique per dynamicTypeName and, consequently, // per unique comparer. However, the code above only ensures // that only one thread will do the generation of the comparer. // We now need to lock the comparerLock for each dynamicTypeName to // make non generating threads wait on the thread that is doing the // generation, so we ensure that the comparer is generated for all // threads by the time we exit the following block. lock (comparerLock) { // This ensures only that first thread in actually does any generation. if (generate) { // declare the source code for the dynamic assembly string compareCode = @" using System; namespace [TypeName]DynamicComparers { public sealed class [ComparerName] : System.Collections.IComparer { public int Compare(object first, object second) { [TypeName] firstInstance = first as [TypeName]; if (firstInstance == null) throw new ArgumentNullException(""First object cannot be null."", ""first""); [TypeName] secondInstance = second as [TypeName]; if (secondInstance == null) throw new ArgumentNullException(""Second object cannot be null."", ""second""); int result = 0; [CompareCode] } } } "; System.Text.StringBuilder compareBuilder = new System.Text.StringBuilder(); string propertyName; bool desc; for (int sortIndex = 0; sortIndex < sorts.Length; sortIndex++) { // check current sort for null, continue if null if (sorts[sortIndex] == null) continue; // split current sort by space to distinguish property from asc/desc string[] sortValues = sorts[sortIndex].Trim().Split(' '); // if there are no values after split, leave -- should have at least the prop name if (sortValues.Length == 0) continue; // prop name will be first value propertyName = sortValues[0].Trim(); // ensure property exists on specified type PropertyInfo prop = type.GetProperty(propertyName); if (prop == null) throw new ArgumentException( String.Format("Specified property '{0}' is not a property of type '{1}'.", propertyName, type.FullName), "sortExpression"); // if there, the second will be asc/desc; compare to get whether or not this // sort is descending desc = (sortValues.Length > 1) ? (sortValues[1].Trim().ToUpper() == "DESC") : false; // if property type is reference type, we need to do null checking in the compare code bool checkForNull = !prop.PropertyType.IsValueType; // check for null if the property is a reference type if (checkForNull) compareBuilder.Append("\t\t\tif (firstInstance." + propertyName + " != null)\n\t"); // compare the property compareBuilder.Append("\t\t\tresult = firstInstance." + propertyName + ".CompareTo(secondInstance." + propertyName + ");"); // check for null on the second type, if necessary if (checkForNull) { // if second type is also null, return true; otherwise, the first instance is // less than the second because it is null compareBuilder.Append("\t\t\telse if (secondInstance." + propertyName + " == null)\n"); compareBuilder.Append("\t\t\t\tresult = 0; else result = -1;\n"); } // if the two are not equal, no further comparison is needed, just return the // current compare value and flip the sign, if the current sort is descending compareBuilder.Append("\t\t\tif (result !=0) return " + (desc ? "-" : "") + "(result);\n"); } // if all comparisons were equal, we'll need the next line to return that result compareBuilder.Append("\t\t\treturn result;"); // replace the type and comparer name placeholders in the source with real values // and insert the property comparisons compareCode = compareCode.Replace("[TypeName]", typeName).Replace("[ComparerName]", comparerName) .Replace("[CompareCode]", compareBuilder.ToString()); //#if TRACE // System.Diagnostics.Debug.WriteLine(compareCode); //#endif // create a C# compiler instance ICodeCompiler compiler = new CSharpCodeProvider().CreateCompiler(); // create a compiler parameters collection CompilerParameters parameters = new CompilerParameters(); // add necessary assembly references for the source to compile string primeAssemblyPath = type.Assembly.Location.Replace("file:///", "").Replace("/", "\\"); parameters.ReferencedAssemblies.Add(primeAssemblyPath); foreach (System.Reflection.AssemblyName asm in type.Assembly.GetReferencedAssemblies()) parameters.ReferencedAssemblies.Add(this.GetAssemblyPath(asm)); // tell the compiler to generate the IL in memory parameters.GenerateInMemory = true; // compile the new dynamic assembly using the parameters and source from above CompilerResults compiled = compiler.CompileAssemblyFromSource(parameters, compareCode); // check for compiler errors if (compiled.Errors.HasErrors) { // build error message from compiler errors string message = "Could not generate a comparer for '{0}'. Errors:\n"; for (int i = 0; i < compiled.Errors.Count; i++) message += compiled.Errors[i].ErrorText + "\n"; // throw an exception with the relevant information throw new ApplicationException( String.Format(message, dynamicTypeName)); } // get an instance of the new type as IComparer comparer = compiled.CompiledAssembly.CreateInstance(dynamicTypeName) as System.Collections.IComparer; // throw an exception if getting the new instance fails if (comparer == null) throw new ApplicationException( String.Format("Could not instantiate the dynamic type '{0}'.", dynamicTypeName)); // add the new comparer to the comparers table lock (comparers) comparers.Add(dynamicTypeName, comparer); } // (generate) } // comparer lock } // comparers cache check // At this point, we should be sure that a comparer has been generated for the // requested dynamicTypeName and stuck in the cache. If we're the thread that // did the generating, comparer will not be null, and we can just return it. // If comparer hasn't been assigned (via generating it above), get it from the cache. if (comparer == null) { // get the comparer from the cache comparer = comparers[dynamicTypeName] as System.Collections.IComparer; // throw an exception if the comparer cannot be retrieved if (comparer == null) throw new ApplicationException( String.Format("Could not retrieve the dynamic type '{0}'.", dynamicTypeName)); } // return the comparer return comparer; } /// <summary> /// Loads the given assembly to get its path (for dynamic compilation reference). /// </summary> /// <param name="assembly">AssemblyName instance to load assembly from.</param> /// <returns>The path for the given assembly or an empty /// string if it can't load/locate it.</returns> protected string GetAssemblyPath(System.Reflection.AssemblyName assembly) { string assemblyFullName = assembly.FullName; string path = string.Empty; path = (string)assemblyPaths[assemblyFullName]; if (path == null) { lock (assemblyPaths.SyncRoot) { path = (string)assemblyPaths[assemblyFullName]; if (path == null) { System.Reflection.Assembly asm = System.Reflection.Assembly.Load(assembly); if (asm != null) { path = asm.Location.Replace("file:///", "").Replace("/", "\\"); } assemblyPaths.Add(assemblyFullName, path); } } } return path; } #endregion } } |
From: Sean M. <int...@us...> - 2006-03-03 05:30:04
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Serialization In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev.Tests/Serialization Added Files: SerializerTest.cs Log Message: --- NEW FILE: SerializerTest.cs --- using System; using Adapdev.Mock; using Adapdev.Serialization; using NUnit.Framework; namespace Adapdev.Tests.Serialization { [TestFixture] public class SerializerTest { [Test] public void SOAP() { SuppliersEntity supplier = new SuppliersEntity(); string soap = Serializer.SerializeToSoap(supplier); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromSoap(typeof(SuppliersEntity), soap); Console.WriteLine(soap); } [Test] public void SOAPFile() { SuppliersEntity supplier = new SuppliersEntity(); Serializer.SerializeToSoap(supplier, "supplier.soap"); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromSoapFile(typeof(SuppliersEntity), "supplier.soap"); Assert.AreEqual(supplier.Created, supplier2.Created); } [Test] public void Xml() { SuppliersEntity supplier = new SuppliersEntity(); string xml = Serializer.SerializeToXml(supplier); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromXml(typeof(SuppliersEntity), xml); Console.WriteLine(xml); } [Test] public void XmlFile() { SuppliersEntity supplier = new SuppliersEntity(); Serializer.SerializeToXmlFile(supplier, "supplier.xml"); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromXmlFile(typeof(SuppliersEntity), "supplier.xml"); Assert.AreEqual(supplier.Created, supplier2.Created); } [Test] public void Binary() { SuppliersEntity supplier = new SuppliersEntity(); byte[] data = Serializer.SerializeToBinary(supplier); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromBinary(typeof(SuppliersEntity), data); } [Test] public void BinaryFile() { SuppliersEntity supplier = new SuppliersEntity(); Serializer.SerializeToBinary(supplier, "supplier.dat"); SuppliersEntity supplier2 = (SuppliersEntity)Serializer.DeserializeFromBinaryFile(typeof(SuppliersEntity), "supplier.dat"); Assert.AreEqual(supplier.Created, supplier2.Created); } } } |
From: Sean M. <int...@us...> - 2006-03-03 05:29:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev.Tests Added Files: Person.cs SortableCollectionBaseTest.cs Log Message: --- NEW FILE: SortableCollectionBaseTest.cs --- using System; using System.Collections; using Adapdev; using NUnit.Framework; namespace Adapdev.Tests { [TestFixture] public class SortableCollectionBaseTest { [Test] public void SortArrayListByAge() { PersonCollection personArray = this.GetPersonCollection(); Assert.AreEqual("Johnny", (personArray[1] as Person).Name); personArray.Sort("Age"); Assert.AreEqual("Joey", (personArray[1] as Person).Name); Assert.AreEqual(25, (personArray[1] as Person).Age); } [Test] public void SortArrayByNameAndAge() { PersonCollection personArray = this.GetPersonCollection(); Assert.AreEqual("Johnny", personArray[1].Name); personArray.Sort("Name, Age"); Assert.AreEqual("C.J.", personArray[0].Name); Assert.AreEqual("Joey", personArray[2].Name); Assert.AreEqual(21, personArray[2].Age); Assert.AreEqual("Joey", personArray[3].Name); Assert.AreEqual(25, personArray[3].Age); } [Test] public void SortArrayByNameAndAgeDESC() { PersonCollection personArray = this.GetPersonCollection(); Assert.AreEqual("Johnny", personArray[1].Name); personArray.Sort("Name, Age DESC"); Assert.AreEqual("C.J.", personArray[0].Name); Assert.AreEqual("Joey", personArray[2].Name); Assert.AreEqual(25, personArray[2].Age); Assert.AreEqual("Joey", personArray[3].Name); Assert.AreEqual(21, personArray[3].Age); } private PersonCollection GetPersonCollection() { PersonCollection personArray = new PersonCollection(); personArray.Add(new Person("Joey", 21)); personArray.Add(new Person("Johnny", 30)); personArray.Add(new Person("Marky", 28)); personArray.Add(new Person("C.J.", 28)); personArray.Add(new Person("Joey", 25)); personArray.Add(new Person("Dee Dee", 33)); return personArray; } } public class PersonCollection : Adapdev.Collections.SortableCollectionBase { public Person this[int index] { get { return this.List[index] as Person; } set { this.List[index] = value; } } public void Add(Person item) { if (!this.List.Contains(item)) this.List.Add(item); } } } --- NEW FILE: Person.cs --- using System; namespace Adapdev.Tests { /// <summary> /// Summary description for Person. /// </summary> public class Person { public string Name { get { return _name; } set { _name = value; } } public int Age { get { return _age; } set { _age = value; } } public Person(string name, int age) { _name = name; _age = age; } public override string ToString() { return Name + ", " + Age; } protected string _name; protected int _age; } } |
From: Sean M. <int...@us...> - 2006-03-03 05:29:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev.Data.Tests Added Files: CommandTextViewerTest.cs ConnectionStringBuilderTest.cs SelectQueryTest.cs Log Message: --- NEW FILE: SelectQueryTest.cs --- using System; using System.Collections; using NUnit.Framework; using Adapdev.Data.Sql; namespace Adapdev.Data.Tests { /// <summary> /// Summary description for SelectQueryTest. /// </summary> /// [TestFixture] public class SelectQueryTest { private DbType _dbType = DbType.ACCESS; private Hashtable q = new Hashtable(); public SelectQueryTest() { q.Add("SQLSERVER_SelectAll", ""); } private string SelectAll() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.AddAll(); return query.Statement; } private string SelectColumns() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.Add("column1"); query.Add("column2"); return query.Statement; } private string SelectColumnsWithTable() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.Add("table2", "column2"); query.Add("column2"); return query.Statement; } private string SelectColumnsWithTableAndAlias() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.Add("column1"); query.AddColumnAlias("table2", "column2", "alias2"); query.AddColumnAlias("column3", "alias3"); return query.Statement; } private string SelectColumnCount() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.AddCount("column"); return query.Statement; } private string SelectCountAll() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.AddCountAll(); return query.Statement; } private string SelectGroupBy() { ISelectQuery query = QueryFactory.CreateSelectQuery(this._dbType); query.SetTable("sometable"); query.AddAll(); query.AddGroupBy("column1"); return query.Statement; } [Test] public void SqlServer() { this._dbType = DbType.SQLSERVER; Assert.AreEqual("SELECT * FROM [sometable]", this.SelectAll(), "SelectAll failed"); Assert.AreEqual("SELECT [column1], [column2] FROM [sometable]", this.SelectColumns(), "SelectColumns failed"); Assert.AreEqual("SELECT [table2].[column2], [column2] FROM [sometable]", this.SelectColumnsWithTable(), "SelectColumnsWithTable failed"); Assert.AreEqual("SELECT [column1], [table2].[column2] AS alias2, [column3] AS alias3 FROM [sometable]", this.SelectColumnsWithTableAndAlias(), "SelectColumnsWithTableAndAlias failed"); Assert.AreEqual("SELECT COUNT([column]) FROM [sometable]", this.SelectColumnCount(), "SelectColumnCount failed"); Assert.AreEqual("SELECT COUNT(*) FROM [sometable]", this.SelectCountAll(), "SelectCountAll failed"); Assert.AreEqual("SELECT * FROM [sometable] GROUP BY [column1]", this.SelectGroupBy(), "SelectGroupBy failed"); Console.WriteLine(this.SelectGroupBy()); } } } --- NEW FILE: CommandTextViewerTest.cs --- using System; using System.Data; using System.Data.OleDb; using System.Data.OracleClient; using System.Data.SqlClient; using Adapdev.Data; using NUnit.Framework; namespace Adapdev.Data.Tests { /// <summary> /// Summary description for CommandTextViewerTest. /// </summary> /// [TestFixture] public class CommandTextViewerTest { private string oledbCommand = "INSERT INTO Test (cInt, cString, cDate, cBool) VALUES (?, ?, ?, ?);"; private string sqlCommand = "INSERT INTO Test (cInt, cString, cDate, cBool) VALUES (@cInt, @cString, @cDate, @cBool);"; private DateTime time = DateTime.Now; [Test] public void ParseOleDbCommand() { OleDbCommand command = new OleDbCommand(); command.CommandText = this.oledbCommand; OleDbParameter cInt = command.Parameters.Add("@cInt", OleDbType.Integer, 1); cInt.Value = 1; OleDbParameter cString = command.Parameters.Add("@cString", OleDbType.VarChar, 20); cString.Value = "test"; OleDbParameter cDate = command.Parameters.Add("@cDate", OleDbType.DBTimeStamp, 20); cDate.Value = new DateTime(2006,2,25,6,18,57); OleDbParameter cBool = command.Parameters.Add("@cBool", OleDbType.Boolean, 20); cBool.Value = false; string cmd = CommandTextViewer.ParseOleDbCommand(command); ValidateResult(cmd); } [Test] public void ParseSqlCommand() { SqlCommand command = new SqlCommand(); command.CommandText = this.sqlCommand; SqlParameter cInt = command.Parameters.Add("@cInt", SqlDbType.Int, 1); cInt.Value = 1; SqlParameter cString = command.Parameters.Add("@cString", SqlDbType.VarChar, 20); cString.Value = "test"; SqlParameter cDate = command.Parameters.Add("@cDate", SqlDbType.DateTime, 20); cDate.Value = new DateTime(2006,2,25,6,18,57); SqlParameter cBool = command.Parameters.Add("@cBool", SqlDbType.Bit, 20); cBool.Value = false; string cmd = CommandTextViewer.ParseSqlCommand(command); ValidateResult(cmd); } [Test] public void ParseOracleCommand() { OracleCommand command = new OracleCommand(); command.CommandText = this.sqlCommand; OracleParameter cInt = command.Parameters.Add("@cInt", OracleType.Int32, 1); cInt.Value = 1; OracleParameter cString = command.Parameters.Add("@cString", OracleType.VarChar, 20); cString.Value = "test"; OracleParameter cDate = command.Parameters.Add("@cDate", OracleType.DateTime, 20); cDate.Value = new DateTime(2006,2,25,6,18,57); OracleParameter cBool = command.Parameters.Add("@cBool", OracleType.Byte, 20); cBool.Value = false; string cmd = CommandTextViewer.ParseOracleCommand(command); ValidateResult(cmd); } private void ValidateResult(string text) { Assert.AreEqual("INSERT INTO Test (cInt, cString, cDate, cBool) VALUES (1, 'test', '2/25/2006 6:18:57 AM', False);", text); } } } --- NEW FILE: ConnectionStringBuilderTest.cs --- using System; using NUnit.Framework; using Adapdev.Data; namespace Adapdev.Data.Tests { /// <summary> /// Summary description for ConnectionStringBuilderTest. /// </summary> /// [TestFixture] public class ConnectionStringBuilderTest { [Test] public void BuildDSN() { string conn = ConnectionStringBuilder.BuildDSN("db", "sa", "password"); Console.WriteLine(conn); } } } |
From: Sean M. <int...@us...> - 2006-03-03 05:29:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev.Tests/IO Added Files: FileUtilTest.cs FileWatcherTest.cs Log Message: --- NEW FILE: FileWatcherTest.cs --- using System; using System.IO; using System.Threading; using Adapdev.IO; using NUnit.Framework; namespace Adapdev.Tests.IO { [TestFixture] public class FileWatcherTest { private string fileName = "someFile.txt"; private bool changeFired = false; [Test] public void WatchFolder() { this.changeFired = false; FileWatcher fw = new FileWatcher(AppDomain.CurrentDomain.BaseDirectory); fw.Changed += new Adapdev.IO.FileWatcher.ChangedEventHandler(fw_Changed); fw.StartWatcher(); FileUtil.CreateFile(this.fileName, "content"); // Sleep so that the event has time to fire. Thread.Sleep(1000); Assert.IsTrue(this.changeFired, "Event didn't fire."); File.Delete(this.fileName); fw.StopWatcher(); } [Test] public void WatchFile() { this.changeFired = false; FileUtil.CreateFile(this.fileName, "content"); FileWatcher fw = new FileWatcher(AppDomain.CurrentDomain.BaseDirectory, this.fileName); fw.Changed += new Adapdev.IO.FileWatcher.ChangedEventHandler(fw_Changed); fw.StartWatcher(); File.Delete(this.fileName); // Sleep so that the event has time to fire. Thread.Sleep(1000); Assert.IsTrue(this.changeFired, "Event didn't fire."); fw.StopWatcher(); } private void fw_Changed(object sender, FileWatcherEventArgs args) { this.changeFired = true; Console.WriteLine("{0} was {1}", args.Path, args.ChangeType.ToString()); } } } --- NEW FILE: FileUtilTest.cs --- using System; using System.IO; using Adapdev.IO; using NUnit.Framework; namespace Adapdev.Tests.IO { [TestFixture] public class FileUtilTest { private string fileName = "someFile.txt"; private string bfileName = "someFile.dat"; [Test] public void CreateAndReadTextFile() { string content = "some content"; FileUtil.CreateFile(this.fileName, content); string content2 = FileUtil.ReadFile(this.fileName); Assert.AreEqual(content, content2); File.Delete(this.fileName); } [Test] public void CreateAndReadBinaryFile() { byte[] data = new byte[]{0,1}; FileUtil.CreateFile(this.bfileName, data); byte[] data2 = FileUtil.ReadBinaryFile(this.bfileName); Assert.AreEqual(data, data2); File.Delete(this.bfileName); } } } |
From: Sean M. <int...@us...> - 2006-03-03 05:29:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/src/Adapdev.Data.Tests/Schema Added Files: SchemaBuilderTest.cs Log Message: --- NEW FILE: SchemaBuilderTest.cs --- using System; using System.Data.OleDb; using NUnit.Framework; namespace Adapdev.Data.Schema.Tests { using Adapdev.Data; using Adapdev.Data.Schema; /// <summary> /// Summary description for SchemaBuilderTest. /// </summary> /// [TestFixture] public class SchemaBuilderTest { 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=;"; [Test] 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")); Assert.AreEqual(Adapdev.Data.DbProviderType.OLEDB, ds.DatabaseProviderType, "ProviderTypes don't match."); 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 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")); Assert.AreEqual(Adapdev.Data.DbProviderType.SQLSERVER, ds.DatabaseProviderType, "ProviderTypes don't match."); 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); } } [Test] public void PrintSqlServerSqlSchema() { int i = 0; Console.WriteLine(new OleDbSchemaBuilder(null, ref i).PrintOleDbSchema(this._oledbConnectionString, OleDbSchemaGuid.Tables, "")); } [Test] public void BuildMySqlSchema() { DatabaseSchema ds = SchemaBuilder.CreateDatabaseSchema(this._mysqlConnectionString, Adapdev.Data.DbType.MYSQL, Adapdev.Data.DbProviderType.MYSQL); Assert.AreEqual(4, ds.Tables.Count, "codus_test should have 4 tables"); Assert.IsTrue(ds.Tables.Contains("alldatatypes")); Assert.AreEqual(Adapdev.Data.DbProviderType.MYSQL, ds.DatabaseProviderType, "ProviderTypes don't match."); Assert.AreEqual(Adapdev.Data.DbType.MYSQL, ds.DatabaseType, "DataTypes don't match."); } [Test,Ignore("")] public void PrintMySqlSchema() { int i = 0; Console.WriteLine(new MySqlSchemaBuilder(null, ref i).PrintReaderSchema(this._mysqlConnectionString, "alldatatypes")); } [Test] 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"); Assert.IsTrue(pc.ConnectionTypes.Contains("SQL Server - Trusted"), "Could not find SQL Server - Trusted"); Assert.IsTrue(pc.ConnectionTypes.Contains("Oracle"), "Could not find Oracle"); Assert.IsTrue(pc.ConnectionTypes.Contains("Oracle - Trusted"), "Could not find Oracle -Trusted"); } [Test] public void ConnectionTypes() { DbConnectionTypes ct = new DbConnectionTypes(); Assert.AreEqual(0, ct.Count, "Should be zero items"); ct.Add("test", new DbConnectionType()); Assert.AreEqual(1, ct.Count, "Should be one item"); Assert.IsTrue(ct.Contains("test"),"Should contain test"); ct.Remove("test"); Assert.AreEqual(0, ct.Count, "Should be zero items after deleting the item"); ct.Add(new DbConnectionType("zarniwoop",DbType.SQLSERVER, "OLEDB",true, true, true, true, false)); ct.Add(new DbConnectionType("beeblebrox",DbType.SQLSERVER, "OLEDB",true, true, true, true, false)); ct.Add(new DbConnectionType("magrathea",DbType.SQLSERVER, "OLEDB",true, true, true, true, false)); ct.Add(new DbConnectionType("marvin",DbType.SQLSERVER, "OLEDB",true, true, true, true, false)); ct.Add(new DbConnectionType("vogon",DbType.SQLSERVER, "OLEDB",true, true, true, true, false)); Assert.AreEqual("beeblebrox", ct.GetByIndex(0).Name); Assert.AreEqual("magrathea", ct.GetByIndex(1).Name); Assert.AreEqual("marvin", ct.GetByIndex(2).Name); Assert.AreEqual("vogon", ct.GetByIndex(3).Name); Assert.AreEqual("zarniwoop", ct.GetByIndex(4).Name); ct.Clear(); Assert.AreEqual(0, ct.Count, "Should be zero items after clearing the collection"); } [Test] public void ConnectionType() { DbConnectionType ct = new DbConnectionType(); Assert.IsNotNull(ct); ct = new DbConnectionType("TestType",DbType.SQLSERVER, "OLEDB", true, true, true, true, false); Assert.IsFalse(ct.SupportsFile); Assert.IsTrue(ct.SupportsServer); ct.SupportsServer = false; Assert.IsTrue(ct.SupportsFile); Assert.IsFalse(ct.SupportsServer); ct.DbType = DbType.ACCESS; Assert.AreEqual("ACCESS", ct.DbTypeName); } [Test] [ExpectedException(typeof(ApplicationException))] public void ConnectionTypeInternalFails() { DbConnectionType ct = new DbConnectionType("TestType",DbType.SQLSERVER, "OLEDB", true, true, true, true, false); Assert.AreEqual("OLEDB", ct.InternalProviderName); Assert.IsNull(ct.InternalProvider); } [Test] public void ConnectionProviders() { DbConnectionProviders cp = new DbConnectionProviders(); Assert.AreEqual(0, cp.Count, "Should be zero items"); cp.Add("test", new DbConnectionProvider()); Assert.AreEqual(1, cp.Count, "Should be one item"); Assert.IsTrue(cp.Contains("test"),"Should contain test"); cp.Remove("test"); Assert.AreEqual(0, cp.Count, "Should be zero items after deleting the item"); DbConnectionType ct = new DbConnectionType("TestType",DbType.SQLSERVER,"OLEDB", true, true, true, true, false); ct.Providers = cp; cp.Add(new DbConnectionProvider("zarniwoop","SQLSERVER", "provider=mssqlserver", ct)); cp.Add(new DbConnectionProvider("beeblebrox","SQLSERVER", "provider=mssqlserver", ct)); cp.Add(new DbConnectionProvider("magrathea","SQLSERVER", "provider=mssqlserver", ct)); cp.Add(new DbConnectionProvider("marvin","SQLSERVER", "provider=mssqlserver", ct)); cp.Add(new DbConnectionProvider("vogon","SQLSERVER", "provider=mssqlserver", ct)); Assert.AreEqual("beeblebrox", cp.GetByIndex(0).Name, "Items out of order"); Assert.AreEqual("magrathea", cp.GetByIndex(1).Name, "Items out of order"); Assert.AreEqual("marvin", cp.GetByIndex(2).Name, "Items out of order"); Assert.AreEqual("vogon", cp.GetByIndex(3).Name, "Items out of order"); Assert.AreEqual("zarniwoop", cp.GetByIndex(4).Name, "Items out of order"); cp.Clear(); Assert.AreEqual(0, cp.Count, "Should be zero items after clearing the collection"); } [Test] public void ConnectionProvider() { DbConnectionType ct = new DbConnectionType("TestType",DbType.SQLSERVER,"OLEDB", true, true, true, true, false); DbConnectionProvider cp = new DbConnectionProvider(); Assert.IsNotNull(cp); cp = new DbConnectionProvider("TestProvider1", "SQLSERVER", "provider=mssqlserver", ct); ct.Providers.Add(cp); cp = new DbConnectionProvider("TestProvider2", "OLEDB", "provider=mssqlserver", ct); ct.Providers.Add(cp); Assert.AreEqual(2, ct.Providers.Count, "Should be two providers."); cp.DbType = DbType.ACCESS; Assert.AreEqual("ACCESS", cp.DbTypeName); cp.ProviderType = DbProviderType.OLEDB; Assert.AreEqual("OLEDB", cp.ProviderTypeName); ct.InternalProviderName = "TestProvider2"; Assert.AreEqual("TestProvider2", ct.InternalProvider.Name, "Internal Provider should be 'TestProvider2'"); Assert.IsNotNull(cp.Parent,"Parent should not be Null. Should be 'TestType'"); Assert.IsNotNull(cp.Parent.InternalProvider,"Internal provider should be defined"); Assert.AreEqual(cp.Parent.InternalProvider.ConnectionString("TestServer"), cp.ConnectionString("TestServer")); cp = new DbConnectionProvider("TestProvider","OLEDB", "{0},{1},{2},{3}", ct); Assert.AreEqual("A,B,C,D", cp.ConnectionString("A","B","C","D")); } } } |
From: Sean M. <int...@us...> - 2006-03-03 05:29:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Serialization In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7816/Serialization Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Serialization added to the repository |
From: Sean M. <int...@us...> - 2006-03-03 05:29:28
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7816/IO Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/IO added to the repository |
From: Sean M. <int...@us...> - 2006-03-03 05:28:54
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7365/Collections Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev/Collections added to the repository |
From: Sean M. <int...@us...> - 2006-03-03 05:22:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3653/src/Adapdev Modified Files: Adapdev.csproj ObjectComparer.cs Log Message: Index: Adapdev.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/Adapdev.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Adapdev.csproj 1 Mar 2006 01:38:51 -0000 1.20 --- Adapdev.csproj 3 Mar 2006 05:22:55 -0000 1.21 *************** *** 341,344 **** --- 341,359 ---- /> <File + RelPath = "Reflection\IClassAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\IFieldAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\IPropertyAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Reflection\IValueAccessor.cs" SubType = "Code" *************** *** 356,359 **** --- 371,379 ---- /> <File + RelPath = "Reflection\ReflectionCache.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Scheduling\Task\ScheduledTasks.cs" SubType = "Code" Index: ObjectComparer.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/ObjectComparer.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ObjectComparer.cs 21 Feb 2006 04:31:18 -0000 1.11 --- ObjectComparer.cs 3 Mar 2006 05:22:55 -0000 1.12 *************** *** 37,49 **** { Type t = x.GetType(); ! ClassAccessor accessor = ClassAccessorCache.Get(t); try { object p1 = null; object p2 = null; ! PropertyAccessor property = null; ! foreach(string key in accessor.GetPropertyAccessors().Keys) { ! property = accessor.GetPropertyAccessor(key); p1 = accessor.GetPropertyValue(x, key); p2 = accessor.GetPropertyValue(y, key); --- 37,49 ---- { Type t = x.GetType(); ! IClassAccessor accessor = ClassAccessorCache.Get(t); try { object p1 = null; object p2 = null; ! IPropertyAccessor property = null; ! foreach(string key in accessor.GetIPropertyAccessors().Keys) { ! property = accessor.GetIPropertyAccessor(key); p1 = accessor.GetPropertyValue(x, key); p2 = accessor.GetPropertyValue(y, key); *************** *** 85,97 **** { Type t = x.GetType(); ! ClassAccessor accessor = ClassAccessorCache.Get(t); try { object p1 = null; object p2 = null; ! FieldAccessor property = null; ! foreach(string key in accessor.GetFieldAccessors().Keys) { ! property = accessor.GetFieldAccessor(key); p1 = accessor.GetFieldValue(x, key); p2 = accessor.GetFieldValue(y, key); --- 85,97 ---- { Type t = x.GetType(); ! IClassAccessor accessor = ClassAccessorCache.Get(t); try { object p1 = null; object p2 = null; ! IFieldAccessor property = null; ! foreach(string key in accessor.GetIFieldAccessors().Keys) { ! property = accessor.GetIFieldAccessor(key); p1 = accessor.GetFieldValue(x, key); p2 = accessor.GetFieldValue(y, key); |
From: Sean M. <int...@us...> - 2006-03-03 05:22:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3653/src/Adapdev.UnitTest.Core Modified Files: RunTestIterationCommand.cs TestRunner.cs Log Message: Index: RunTestIterationCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/RunTestIterationCommand.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RunTestIterationCommand.cs 30 Dec 2005 20:42:11 -0000 1.9 --- RunTestIterationCommand.cs 3 Mar 2006 05:22:55 -0000 1.10 *************** *** 154,158 **** } ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ti.MemoryUsed = (kEnd - kStart)/1024; --- 154,158 ---- } ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = this.FilterAdapdev(e.InnerException.StackTrace); ti.MemoryUsed = (kEnd - kStart)/1024; *************** *** 164,168 **** ti.State = TestState.ForcedIgnore; ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; } else --- 164,168 ---- ti.State = TestState.ForcedIgnore; ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = this.FilterAdapdev(e.InnerException.StackTrace); } else *************** *** 170,174 **** ti.Result = e.InnerException.Message; ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = e.InnerException.StackTrace; ti.State = TestState.Fail; } --- 170,174 ---- ti.Result = e.InnerException.Message; ti.ExceptionType = e.InnerException.GetType().FullName; ! ti.FullStackTrace = this.FilterAdapdev(e.InnerException.StackTrace); ti.State = TestState.Fail; } *************** *** 237,240 **** --- 237,261 ---- } + private string FilterAdapdev(string exception) + { + int last = exception.LastIndexOf("Adapdev.UnitTest.Assert"); + + // make sure it's present + if(last > -1) + { + int line = exception.IndexOf("at", last); + + // make sure it's present + if(line > -1 && line > last && line < exception.Length) + return exception.Substring(line, exception.Length - line); + else + return exception; + } + else + { + return exception; + } + } + public object Execute(object o){this.Execute();return 1;} Index: TestRunner.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestRunner.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TestRunner.cs 21 Feb 2006 04:31:18 -0000 1.14 --- TestRunner.cs 3 Mar 2006 05:22:55 -0000 1.15 *************** *** 1,2 **** --- 1,3 ---- + using System.Text; using Adapdev.Reflection; |
From: Sean M. <int...@us...> - 2006-03-03 05:22:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3653/src/Adapdev.Data/Sql Modified Files: DeleteQuery.cs ISqlQuery.cs InsertQuery.cs SelectQuery.cs UpdateQuery.cs Log Message: Index: InsertQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/InsertQuery.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** InsertQuery.cs 12 Jan 2006 05:42:34 -0000 1.7 --- InsertQuery.cs 3 Mar 2006 05:22:54 -0000 1.8 *************** *** 116,119 **** --- 116,124 ---- } + public string Statement + { + get{return this.GetText();} + } + } } \ No newline at end of file Index: SelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/SelectQuery.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SelectQuery.cs 21 Jan 2006 06:02:52 -0000 1.12 --- SelectQuery.cs 3 Mar 2006 05:22:54 -0000 1.13 *************** *** 287,290 **** --- 287,296 ---- } } + + public string Statement + { + get{return this.GetText();} + } + } Index: ISqlQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/ISqlQuery.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ISqlQuery.cs 21 Jan 2006 19:42:48 -0000 1.1 --- ISqlQuery.cs 3 Mar 2006 05:22:54 -0000 1.2 *************** *** 29,32 **** --- 29,37 ---- DbProviderType DbProviderType { get; set; } ICriteria Criteria{get;} + /// <summary> + /// Gets the sql statement. + /// </summary> + /// <value>The statement.</value> + string Statement{get;} } } \ No newline at end of file Index: UpdateQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/UpdateQuery.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UpdateQuery.cs 12 Jan 2006 05:42:34 -0000 1.7 --- UpdateQuery.cs 3 Mar 2006 05:22:54 -0000 1.8 *************** *** 83,86 **** --- 83,91 ---- } + public string Statement + { + get{return this.GetText();} + } + } } \ No newline at end of file Index: DeleteQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/DeleteQuery.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DeleteQuery.cs 30 Dec 2005 20:42:11 -0000 1.6 --- DeleteQuery.cs 3 Mar 2006 05:22:54 -0000 1.7 *************** *** 59,62 **** --- 59,66 ---- } + public string Statement + { + get{return this.GetText();} + } } } \ No newline at end of file |
From: Sean M. <int...@us...> - 2006-03-03 05:22:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3653/src/Adapdev.Data.Tests Modified Files: Adapdev.Data.Tests.csproj Log Message: Index: Adapdev.Data.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests/Adapdev.Data.Tests.csproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Adapdev.Data.Tests.csproj 1 Mar 2006 01:38:50 -0000 1.16 --- Adapdev.Data.Tests.csproj 3 Mar 2006 05:22:54 -0000 1.17 *************** *** 135,138 **** --- 135,143 ---- BuildAction = "Compile" /> + <File + RelPath = "SelectQueryTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> <Folder RelPath = "bin\Debug\" /> <File |
From: Sean M. <int...@us...> - 2006-03-03 05:22:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Reflection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3653/src/Adapdev.Tests/Reflection Modified Files: ClassAccessorCacheTest.cs ClassAccessorTest.cs Log Message: Index: ClassAccessorCacheTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Reflection/ClassAccessorCacheTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassAccessorCacheTest.cs 26 Nov 2005 08:27:35 -0000 1.5 --- ClassAccessorCacheTest.cs 3 Mar 2006 05:22:54 -0000 1.6 *************** *** 21,25 **** public void GetByType() { ! ClassAccessor c = ClassAccessorCache.Get(typeof(PropertyAccessorTestObject)); Assert.IsNotNull(c); Assert.AreEqual(typeof(PropertyAccessorTestObject), c.Type); --- 21,25 ---- public void GetByType() { ! IClassAccessor c = ClassAccessorCache.Get(typeof(PropertyAccessorTestObject)); Assert.IsNotNull(c); Assert.AreEqual(typeof(PropertyAccessorTestObject), c.Type); *************** *** 30,34 **** { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! ClassAccessor c = ClassAccessorCache.Get(o); Assert.IsNotNull(c); Assert.AreEqual(o.GetType(), c.Type); --- 30,34 ---- { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! IClassAccessor c = ClassAccessorCache.Get(o); Assert.IsNotNull(c); Assert.AreEqual(o.GetType(), c.Type); *************** *** 39,43 **** { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! ClassAccessor c = ClassAccessorCache.Get(o); Assert.AreEqual(1, ClassAccessorCache.Count); } --- 39,43 ---- { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! IClassAccessor c = ClassAccessorCache.Get(o); Assert.AreEqual(1, ClassAccessorCache.Count); } *************** *** 47,51 **** { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! ClassAccessor c = ClassAccessorCache.Get(o); Assert.AreEqual(1, ClassAccessorCache.Count); ClassAccessorCache.Remove(c.Type); --- 47,51 ---- { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! IClassAccessor c = ClassAccessorCache.Get(o); Assert.AreEqual(1, ClassAccessorCache.Count); ClassAccessorCache.Remove(c.Type); *************** *** 57,61 **** { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! ClassAccessor c = ClassAccessorCache.Get(o); c.LoadAllProperties(); Console.WriteLine(ClassAccessorCache.ToString()); --- 57,61 ---- { PropertyAccessorTestObject o = new PropertyAccessorTestObject(); ! IClassAccessor c = ClassAccessorCache.Get(o); c.LoadAllProperties(); Console.WriteLine(ClassAccessorCache.ToString()); Index: ClassAccessorTest.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Reflection/ClassAccessorTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassAccessorTest.cs 21 Feb 2006 04:31:17 -0000 1.5 --- ClassAccessorTest.cs 3 Mar 2006 05:22:54 -0000 1.6 *************** *** 124,128 **** Assert.AreEqual(36, c.TotalCount, "Should have loaded 36 total."); Assert.AreEqual(19, c.FieldCount, "Should have loaded 19 fields."); ! Assert.AreEqual(15, c.PropertyCount, "Should have loaded 15 properties."); } --- 124,128 ---- Assert.AreEqual(36, c.TotalCount, "Should have loaded 36 total."); Assert.AreEqual(19, c.FieldCount, "Should have loaded 19 fields."); ! Assert.AreEqual(17, c.PropertyCount, "Should have loaded 17 properties."); } *************** *** 135,139 **** c.LoadAllProperties(); ! PropertyAccessor p = c.GetPropertyAccessor("Int"); Assert.IsTrue(p.CanRead); Assert.IsTrue(p.CanWrite); --- 135,139 ---- c.LoadAllProperties(); ! IPropertyAccessor p = c.GetIPropertyAccessor("Int"); Assert.IsTrue(p.CanRead); Assert.IsTrue(p.CanWrite); *************** *** 150,154 **** c.LoadAllFields(); ! FieldAccessor f = c.GetFieldAccessor("mInt"); Assert.AreEqual(typeof(FieldAccessorTestObject), f.TargetType); Assert.AreEqual(typeof(Int32), f.FieldType); --- 150,154 ---- c.LoadAllFields(); ! IFieldAccessor f = c.GetIFieldAccessor("mInt"); Assert.AreEqual(typeof(FieldAccessorTestObject), f.TargetType); Assert.AreEqual(typeof(Int32), f.FieldType); |