New test.
[mono.git] / mcs / class / Npgsql / Test / CommandTests.cs
old mode 100755 (executable)
new mode 100644 (file)
index 2aa4d56..8da7d95
@@ -26,30 +26,30 @@ using Npgsql;
 using NUnit.Framework;
 using NUnit.Core;
 using System.Data;
+using System.Globalization;
 using NpgsqlTypes;
 
+
 namespace NpgsqlTests
 {
-       
        [TestFixture]
        public class CommandTests
        {
-               private NpgsqlConnection        _conn = null;
-               private String                                          _connString = "Server=localhost;User ID=npgsql_tests;Password=npgsql_tests;Database=npgsql_tests;SSL=yes";
+               NpgsqlConnection _conn = null;
                
                [SetUp]
                protected void SetUp()
                {
                        //NpgsqlEventLog.Level = LogLevel.None;
-                       NpgsqlEventLog.Level = LogLevel.Debug;
-                       NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
-                       _conn = new NpgsqlConnection(_connString);
+                       //NpgsqlEventLog.Level = LogLevel.Debug;
+                       //NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
+                       _conn = new NpgsqlConnection (TestConfiguration.NpgsqlConnectionString);
                }
                
                [TearDown]
                protected void TearDown()
                {
-                       if (_conn.State != ConnectionState.Closed)
+                       if (_conn != null && _conn.State != ConnectionState.Closed)
                                _conn.Close();
                }
                
@@ -67,14 +67,14 @@ namespace NpgsqlTests
                        
                        // Get by indexers.
                        
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter1", command.Parameters[":Parameter1"].ParameterName);
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter2", command.Parameters[":Parameter2"].ParameterName);
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter3", command.Parameters[":Parameter3"].ParameterName);
+                       Assert.AreEqual(":Parameter1", command.Parameters[":Parameter1"].ParameterName);
+                       Assert.AreEqual(":Parameter2", command.Parameters[":Parameter2"].ParameterName);
+                       Assert.AreEqual(":Parameter3", command.Parameters[":Parameter3"].ParameterName);
                                                                 
 
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter1", command.Parameters[0].ParameterName);
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter2", command.Parameters[1].ParameterName);
-                       Assertion.AssertEquals("ParametersGetName", ":Parameter3", command.Parameters[2].ParameterName);                                                             
+                       Assert.AreEqual(":Parameter1", command.Parameters[0].ParameterName);
+                       Assert.AreEqual(":Parameter2", command.Parameters[1].ParameterName);
+                       Assert.AreEqual(":Parameter3", command.Parameters[2].ParameterName);                                                         
                        
                        
                        
@@ -90,7 +90,7 @@ namespace NpgsqlTests
                        
                }
                [Test]
-               [ExpectedException(typeof(NpgsqlException))]
+               [ExpectedException(typeof(ArgumentNullException))]
                public void NoNameParameterAdd()
                {
                        NpgsqlCommand command = new NpgsqlCommand();
@@ -122,7 +122,7 @@ namespace NpgsqlTests
                        
                        Object result = command.ExecuteScalar();
                        
-                       Assertion.AssertEquals(5, result);
+                       Assert.AreEqual(5, result);
                        //reader.FieldCount
                        
                }
@@ -137,7 +137,7 @@ namespace NpgsqlTests
                                                
                        Object result = command.ExecuteScalar();
                        
-                       Assertion.AssertEquals(5, result);
+                       Assert.AreEqual(5, result);
                        //reader.FieldCount
                        
                }
@@ -154,7 +154,7 @@ namespace NpgsqlTests
                        command.Prepare();
                        Object result = command.ExecuteScalar();
                        
-                       Assertion.AssertEquals(5, result);
+                       Assert.AreEqual(5, result);
                        //reader.FieldCount
                        
                }
@@ -173,11 +173,31 @@ namespace NpgsqlTests
                                                
                        Int64 result = (Int64) command.ExecuteScalar();
                        
-                       Assertion.AssertEquals(1, result);
+                       Assert.AreEqual(1, result);
                        
                        
                }
                
+               [Test]
+               public void FunctionCallWithParametersReturnSingleValueNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("funcC(:a)", _conn);
+                       command.CommandType = CommandType.StoredProcedure;
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Integer));
+                                               
+                       command.Parameters[0].Value = 4;
+                                               
+                       Int64 result = (Int64) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(1, result);
+                       
+               }
+               
+               
+               
                
                [Test]
                public void FunctionCallWithParametersPrepareReturnSingleValue()
@@ -190,7 +210,7 @@ namespace NpgsqlTests
                        
                        command.Parameters.Add(new NpgsqlParameter("a", DbType.Int32));
                        
-                       Assertion.AssertEquals(1, command.Parameters.Count);
+                       Assert.AreEqual(1, command.Parameters.Count);
                        command.Prepare();
                        
                        
@@ -198,11 +218,36 @@ namespace NpgsqlTests
                                                
                        Int64 result = (Int64) command.ExecuteScalar();
                        
-                       Assertion.AssertEquals(1, result);
+                       Assert.AreEqual(1, result);
                        
                        
                }
                
+               [Test]
+               public void FunctionCallWithParametersPrepareReturnSingleValueNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("funcC(:a)", _conn);
+                       command.CommandType = CommandType.StoredProcedure;
+                       
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Integer));
+                       
+                       Assert.AreEqual(1, command.Parameters.Count);
+                       command.Prepare();
+                       
+                       
+                       command.Parameters[0].Value = 4;
+                                               
+                       Int64 result = (Int64) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(1, result);
+                       
+                       
+               }
+               
+               
                [Test]
                public void FunctionCallReturnResultSet()
                {
@@ -243,7 +288,7 @@ namespace NpgsqlTests
                                i++;
                        }
                        
-                       Assertion.AssertEquals(3, i);
+                       Assert.AreEqual(3, i);
                        
                        
                        i = 0;
@@ -257,7 +302,7 @@ namespace NpgsqlTests
                                i++;
                        }
                        
-                       Assertion.AssertEquals(1, i);
+                       Assert.AreEqual(1, i);
                        
                        command.CommandText = "close te;";
                        
@@ -295,9 +340,35 @@ namespace NpgsqlTests
                        command.Parameters.Add(new NpgsqlParameter("a", DbType.Int32));
                        command.Parameters.Add(new NpgsqlParameter("b", DbType.Int64));
                        
-                       Assertion.AssertEquals(2, command.Parameters.Count);
+                       Assert.AreEqual(2, command.Parameters.Count);
+                       
+                       Assert.AreEqual(DbType.Int32, command.Parameters[0].DbType);
+                       
+                       command.Prepare();
+                       
+                       command.Parameters[0].Value = 3;
+                       command.Parameters[1].Value = 5;
+                       
+                       NpgsqlDataReader dr = command.ExecuteReader();
+                       
+                       
+                       
                        
-                       Assertion.AssertEquals(DbType.Int32, command.Parameters[0].DbType);
+               }
+               
+               [Test]
+               public void PreparedStatementWithParametersNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select * from tablea where field_int4 = :a and field_int8 = :b;", _conn);
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Integer));
+                       command.Parameters.Add(new NpgsqlParameter("b", NpgsqlDbType.Bigint));
+                       
+                       Assert.AreEqual(2, command.Parameters.Count);
+                       
+                       Assert.AreEqual(DbType.Int32, command.Parameters[0].DbType);
                        
                        command.Prepare();
                        
@@ -311,6 +382,7 @@ namespace NpgsqlTests
                        
                }
                
+               
                [Test]
                [ExpectedException(typeof(InvalidOperationException))]
                public void ListenNotifySupport()
@@ -347,8 +419,43 @@ namespace NpgsqlTests
                        DateTime d = (DateTime)command.ExecuteScalar();
                        
                        
-                       Assertion.AssertEquals("2002-02-02 09:00:23Z", d.ToString("u"));
+                       Assert.AreEqual("2002-02-02 09:00:23Z", d.ToString("u"));
                        
+                       DateTimeFormatInfo culture = new DateTimeFormatInfo();
+                       culture.TimeSeparator = ":";
+                       DateTime dt = System.DateTime.Parse("2004-06-04 09:48:00", culture);
+
+                       command.CommandText = "insert into tableb(field_timestamp) values (:a);delete from tableb where field_serial > 4;";
+                       command.Parameters.Add(new NpgsqlParameter("a", DbType.DateTime));
+                       command.Parameters[0].Value = dt;
+                       
+                       command.ExecuteScalar();
+                       
+               }
+               
+               
+               [Test]
+               public void DateTimeSupportNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_timestamp from tableb where field_serial = 2;", _conn);
+                       
+                       DateTime d = (DateTime)command.ExecuteScalar();
+                       
+                       
+                       Assert.AreEqual("2002-02-02 09:00:23Z", d.ToString("u"));
+                       
+                       DateTimeFormatInfo culture = new DateTimeFormatInfo();
+                       culture.TimeSeparator = ":";
+                       DateTime dt = System.DateTime.Parse("2004-06-04 09:48:00", culture);
+
+                       command.CommandText = "insert into tableb(field_timestamp) values (:a);delete from tableb where field_serial > 4;";
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Timestamp));
+                       command.Parameters[0].Value = dt;
+                       
+                       command.ExecuteScalar();
                        
                }
                
@@ -362,7 +469,7 @@ namespace NpgsqlTests
                        DateTime d = (DateTime)command.ExecuteScalar();
                        
                        
-                       Assertion.AssertEquals("2002-03-04", d.ToString("yyyy-MM-dd"));
+                       Assert.AreEqual("2002-03-04", d.ToString("yyyy-MM-dd"));
                        
                }
                
@@ -376,7 +483,7 @@ namespace NpgsqlTests
                        DateTime d = (DateTime)command.ExecuteScalar();
                        
                        
-                       Assertion.AssertEquals("10:03:45.345", d.ToString("HH:mm:ss.fff"));
+                       Assert.AreEqual("10:03:45.345", d.ToString("HH:mm:ss.fff"));
                        
                }
                
@@ -393,7 +500,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select * from tableb where field_numeric = :a";
                        
@@ -409,13 +516,50 @@ namespace NpgsqlTests
                        command.ExecuteNonQuery();
                        
                        
-                       Assertion.AssertEquals(7.4M, result);
+                       Assert.AreEqual(7.4000000M, result);
                        
                        
                        
                        
                }
                
+               [Test]
+               public void NumericSupportNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tableb(field_numeric) values (:a)", _conn);
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Numeric));
+                       
+                       command.Parameters[0].Value = 7.4M;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select * from tableb where field_numeric = :a";
+                       
+                       
+                       NpgsqlDataReader dr = command.ExecuteReader();
+                       dr.Read();
+                       
+                       Decimal result = dr.GetDecimal(3);
+                       
+                       
+                       command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb) and field_serial != 3;";
+                       command.Parameters.Clear();
+                       command.ExecuteNonQuery();
+                       
+                       
+                       Assert.AreEqual(7.4000000M, result);
+                       
+                       
+                       
+                       
+               }
+               
+               
                [Test]
                public void InsertSingleValue()
                {
@@ -429,7 +573,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select * from tabled where field_float4 = :a";
                        
@@ -445,7 +589,41 @@ namespace NpgsqlTests
                        command.ExecuteNonQuery();
                        
                        
-                       Assertion.AssertEquals(7.4F, result);
+                       Assert.AreEqual(7.4F, result);
+                       
+               }
+               
+               
+               [Test]
+               public void InsertSingleValueNpgsqlDbType()
+               {
+                 _conn.Open();
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tabled(field_float4) values (:a)", _conn);
+                       command.Parameters.Add(new NpgsqlParameter(":a", NpgsqlDbType.Real));
+                       
+                       command.Parameters[0].Value = 7.4F;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select * from tabled where field_float4 = :a";
+                       
+                       
+                       NpgsqlDataReader dr = command.ExecuteReader();
+                       dr.Read();
+                       
+                       Single result = dr.GetFloat(1);
+                       
+                       
+                       command.CommandText = "delete from tabled where field_serial > 2;";
+                       command.Parameters.Clear();
+                       command.ExecuteNonQuery();
+                       
+                       
+                       Assert.AreEqual(7.4F, result);
                        
                }
                
@@ -462,7 +640,41 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select * from tabled where field_float8 = :a";
+                       
+                       
+                       NpgsqlDataReader dr = command.ExecuteReader();
+                       dr.Read();
+                       
+                       Double result = dr.GetDouble(2);
+                       
+                       
+                       command.CommandText = "delete from tabled where field_serial > 2;";
+                       command.Parameters.Clear();
+                       //command.ExecuteNonQuery();
+                       
+                       
+                       Assert.AreEqual(7.4D, result);
+                       
+               }
+               
+               
+               [Test]
+               public void InsertDoubleValueNpgsqlDbType()
+               {
+                 _conn.Open();
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tabled(field_float8) values (:a)", _conn);
+                       command.Parameters.Add(new NpgsqlParameter(":a", NpgsqlDbType.Double));
+                       
+                       command.Parameters[0].Value = 7.4D;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select * from tabled where field_float8 = :a";
                        
@@ -478,10 +690,11 @@ namespace NpgsqlTests
                        //command.ExecuteNonQuery();
                        
                        
-                       Assertion.AssertEquals(7.4D, result);
+                       Assert.AreEqual(7.4D, result);
                        
                }
                
+               
                [Test]
                public void NegativeNumericSupport()
                {
@@ -496,10 +709,11 @@ namespace NpgsqlTests
                        
                        Decimal result = dr.GetDecimal(3);
                        
-                       Assertion.AssertEquals(-4.3M, result);
+                       Assert.AreEqual(-4.3000000M, result);
                        
                }
                
+               
                [Test]
                public void PrecisionScaleNumericSupport()
                {
@@ -514,9 +728,9 @@ namespace NpgsqlTests
                        
                        Decimal result = dr.GetDecimal(3);
                        
-                       Assertion.AssertEquals(-4.3M, (Decimal)result);
-                       //Assertion.AssertEquals(11, result.Precision);
-                       //Assertion.AssertEquals(7, result.Scale);
+                       Assert.AreEqual(-4.3000000M, (Decimal)result);
+                       //Assert.AreEqual(11, result.Precision);
+                       //Assert.AreEqual(7, result.Scale);
                        
                }
                
@@ -533,7 +747,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tablea where field_text is null";
                        command.Parameters.Clear();
@@ -543,11 +757,42 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea) and field_serial != 4;";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(4, result);
+                       Assert.AreEqual(4, result);
                        
                        
                        
                }
+               
+               [Test]
+               public void InsertNullStringNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tablea(field_text) values (:a)", _conn);
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Text));
+                       
+                       command.Parameters[0].Value = DBNull.Value;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select count(*) from tablea where field_text is null";
+                       command.Parameters.Clear();
+                       
+                       Int64 result = (Int64)command.ExecuteScalar();
+                       
+                       command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea) and field_serial != 4;";
+                       command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(4, result);
+                       
+                       
+                       
+               }
+               
+               
        
                [Test]
                public void InsertNullDateTime()
@@ -562,7 +807,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tableb where field_timestamp is null";
                        command.Parameters.Clear();
@@ -572,13 +817,44 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb) and field_serial != 3;";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(4, result);
+                       Assert.AreEqual(4, result);
                        
                        
                        
                }
                
                
+               [Test]
+               public void InsertNullDateTimeNpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tableb(field_timestamp) values (:a)", _conn);
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Timestamp));
+                       
+                       command.Parameters[0].Value = DBNull.Value;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select count(*) from tableb where field_timestamp is null";
+                       command.Parameters.Clear();
+                       
+                       Object result = command.ExecuteScalar();
+                       
+                       command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb) and field_serial != 3;";
+                       command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(4, result);
+                       
+                       
+                       
+               }
+               
+               
+               
                [Test]
                public void InsertNullInt16()
                {
@@ -593,7 +869,37 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
+                       
+                       command.CommandText = "select count(*) from tableb where field_int2 is null";
+                       command.Parameters.Clear();
+                       
+                       Object result = command.ExecuteScalar(); // The missed cast is needed as Server7.2 returns Int32 and Server7.3+ returns Int64
+                       
+                       command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb);";
+                       command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(4, result);
+                       
+                       
+               }
+               
+               
+               [Test]
+               public void InsertNullInt16NpgsqlDbType()
+               {
+                       _conn.Open();
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("insert into tableb(field_int2) values (:a)", _conn);
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Smallint));
+                       
+                       command.Parameters[0].Value = DBNull.Value;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tableb where field_int2 is null";
                        command.Parameters.Clear();
@@ -603,7 +909,7 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb);";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(4, result);
+                       Assert.AreEqual(4, result);
                        
                        
                }
@@ -623,7 +929,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tablea where field_int4 is null";
                        command.Parameters.Clear();
@@ -633,7 +939,7 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea);";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(5, result);
+                       Assert.AreEqual(5, result);
                        
                }
                
@@ -652,7 +958,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tableb where field_numeric is null";
                        command.Parameters.Clear();
@@ -662,7 +968,7 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tableb where field_serial = (select max(field_serial) from tableb);";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(3, result);
+                       Assert.AreEqual(3, result);
                        
                }
                
@@ -680,7 +986,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = "select count(*) from tablea where field_bool is null";
                        command.Parameters.Clear();
@@ -690,7 +996,7 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea);";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(5, result);
+                       Assert.AreEqual(5, result);
                        
                }
         
@@ -707,7 +1013,7 @@ namespace NpgsqlTests
                        
                        Int32 rowsAdded = command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, rowsAdded);
+                       Assert.AreEqual(1, rowsAdded);
                        
                        command.CommandText = String.Format("select count(*) from tablea where field_text = '{0}'", command.Parameters[0].Value);
                        command.Parameters.Clear();
@@ -717,7 +1023,7 @@ namespace NpgsqlTests
                        command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea);";
                        command.ExecuteNonQuery();
                        
-                       Assertion.AssertEquals(1, result);
+                       Assert.AreEqual(1, result);
                        
                }
                
@@ -739,7 +1045,7 @@ namespace NpgsqlTests
             command.ExecuteScalar();
             
             
-            Assertion.AssertEquals(6, result);
+            Assert.AreEqual(6, result);
             
             
                }
@@ -774,6 +1080,7 @@ namespace NpgsqlTests
             
         }
         
+        
         [Test]
         public void AmbiguousFunctionParameterType()
         {
@@ -810,6 +1117,162 @@ namespace NpgsqlTests
             
         }
         
+        
+        [Test]
+               public void TestParameterReplace()
+               {
+                       _conn.Open();
+                       
+                       String sql = @"select * from tablea where 
+                       field_serial = :a
+                       ";
+                       
+                       
+                       NpgsqlCommand command = new NpgsqlCommand(sql, _conn);
+                       
+                       command.Parameters.Add(new NpgsqlParameter("a", DbType.Int32));
+                       
+                       command.Parameters[0].Value = 2;
+                       
+                       Int32 rowsAdded = command.ExecuteNonQuery();
+                       
+               }
+               
+               [Test]
+               public void TestPointSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_point from tablee where field_serial = 1", _conn);
+                       
+                       NpgsqlPoint p = (NpgsqlPoint) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(4, p.X);
+                       Assert.AreEqual(3, p.Y);
+               }
+               
+               
+               [Test]
+               public void TestBoxSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_box from tablee where field_serial = 2", _conn);
+                       
+                       NpgsqlBox box = (NpgsqlBox) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(5, box.UpperRight.X);
+                       Assert.AreEqual(4, box.UpperRight.Y);
+                       Assert.AreEqual(4, box.LowerLeft.X);
+                       Assert.AreEqual(3, box.LowerLeft.Y);
+                       
+                       
+               }
+               
+               [Test]
+               public void TestLSegSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_lseg from tablee where field_serial = 3", _conn);
+                       
+                       NpgsqlLSeg lseg = (NpgsqlLSeg) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(4, lseg.Start.X);
+                       Assert.AreEqual(3, lseg.Start.Y);
+                       Assert.AreEqual(5, lseg.End.X);
+                       Assert.AreEqual(4, lseg.End.Y);
+                       
+                       
+               }
+               
+               [Test]
+               public void TestClosedPathSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_path from tablee where field_serial = 4", _conn);
+                       
+                       NpgsqlPath path = (NpgsqlPath) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(false, path.Open);
+                       Assert.AreEqual(2, path.Count);
+                       Assert.AreEqual(4, path[0].X);
+                       Assert.AreEqual(3, path[0].Y);
+                       Assert.AreEqual(5, path[1].X);
+                       Assert.AreEqual(4, path[1].Y);
+                       
+                       
+               }
+               
+               [Test]
+               public void TestOpenPathSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_path from tablee where field_serial = 5", _conn);
+                       
+                       NpgsqlPath path = (NpgsqlPath) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(true, path.Open);
+                       Assert.AreEqual(2, path.Count);
+                       Assert.AreEqual(4, path[0].X);
+                       Assert.AreEqual(3, path[0].Y);
+                       Assert.AreEqual(5, path[1].X);
+                       Assert.AreEqual(4, path[1].Y);
+                       
+                       
+               }
+               
+               
+               
+               [Test]
+               public void TestPolygonSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_polygon from tablee where field_serial = 6", _conn);
+                       
+                       NpgsqlPolygon polygon = (NpgsqlPolygon) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(2, polygon.Count);
+                       Assert.AreEqual(4, polygon[0].X);
+                       Assert.AreEqual(3, polygon[0].Y);
+                       Assert.AreEqual(5, polygon[1].X);
+                       Assert.AreEqual(4, polygon[1].Y);
+                       
+                       
+               }
+               
+               
+               [Test]
+               public void TestCircleSupport()
+               {
+                       
+                       _conn.Open();
+                       
+                       NpgsqlCommand command = new NpgsqlCommand("select field_circle from tablee where field_serial = 7", _conn);
+                       
+                       NpgsqlCircle circle = (NpgsqlCircle) command.ExecuteScalar();
+                       
+                       Assert.AreEqual(4, circle.Center.X);
+                       Assert.AreEqual(3, circle.Center.Y);
+                       Assert.AreEqual(5, circle.Radius);
+                       
+                       
+                       
+               }
+               
+               
+               
+               
+               
                
        }
 }