Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13720/NHibernate.Test/SqlCommandTest
Modified Files:
SqlStringFixture.cs
Log Message:
Added a Count property on SqlString to help with creating SqlStringBuilders
with the correct initial capacity
Index: SqlStringFixture.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest/SqlStringFixture.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SqlStringFixture.cs 26 Aug 2004 14:28:44 -0000 1.4
--- SqlStringFixture.cs 13 Sep 2004 07:11:05 -0000 1.5
***************
*** 121,124 ****
--- 121,140 ----
[Test]
+ public void Count()
+ {
+ SqlString sql = new SqlString( new object[] {"select", " from table where a = ", new Parameter(), " and b = " , new Parameter() } );
+ Assert.AreEqual( 5, sql.Count, "Count with no nesting failed." );
+
+ sql = sql.Append( new SqlString( new object[] {" more parts ", " another part "} ) );
+ Assert.AreEqual( 7, sql.Count, "Added a SqlString to a SqlString" );
+
+ SqlString nestedSql = new SqlString( new object[] { "nested 1", "nested 2" } );
+
+ sql = sql.Append( new SqlString( new object[] { nestedSql, " not nested 1", " not nested 2" } ) );
+
+ Assert.AreEqual( 11, sql.Count, "Added 2 more levels of nesting" );
+ }
+
+ [Test]
public void EndsWith()
{
|