public void ResetDbType()
        {
            NpgsqlParameter p;

            //Parameter with an assigned value but no DbType specified
            p = new NpgsqlParameter("foo", 42);
            p.ResetDbType();
            Assert.AreEqual(DbType.Int32, p.DbType, "#A:DbType");
            Assert.AreEqual(NpgsqlDbType.Integer, p.NpgsqlDbType, "#A:NpgsqlDbType");
            Assert.AreEqual(42, p.Value, "#A:Value");

            p.DbType = DbType.DateTime; //assigning a DbType
            Assert.AreEqual(DbType.DateTime, p.DbType, "#B:DbType1");
            Assert.AreEqual(NpgsqlDbType.Timestamp, p.NpgsqlDbType, "#B:SqlDbType1");
            p.ResetDbType();
            Assert.AreEqual(DbType.Int32, p.DbType, "#B:DbType2");
            Assert.AreEqual(NpgsqlDbType.Integer, p.NpgsqlDbType, "#B:SqlDbtype2");

            //Parameter with an assigned NpgsqlDbType but no specified value
            p = new NpgsqlParameter("foo", NpgsqlDbType.Integer);
            p.ResetDbType();
            Assert.AreEqual(DbType.String, p.DbType, "#C:DbType");
            Assert.AreEqual(NpgsqlDbType.Text, p.NpgsqlDbType, "#C:NpgsqlDbType");

            p.DbType = DbType.DateTime; //assigning a NpgsqlDbType
            Assert.AreEqual(DbType.DateTime, p.DbType, "#D:DbType1");
            Assert.AreEqual(NpgsqlDbType.Timestamp, p.NpgsqlDbType, "#D:SqlDbType1");
            p.ResetDbType();
            Assert.AreEqual(DbType.String, p.DbType, "#D:DbType2");
            Assert.AreEqual(NpgsqlDbType.Text, p.NpgsqlDbType, "#D:SqlDbType2");

            p = new NpgsqlParameter();
            p.Value = DateTime.MaxValue;
            Assert.AreEqual(DbType.DateTime, p.DbType, "#E:DbType1");
            Assert.AreEqual(NpgsqlDbType.Timestamp, p.NpgsqlDbType, "#E:SqlDbType1");
            p.Value = null;
            p.ResetDbType();
            Assert.AreEqual(DbType.String, p.DbType, "#E:DbType2");
            Assert.AreEqual(NpgsqlDbType.Text, p.NpgsqlDbType, "#E:SqlDbType2");

            p = new NpgsqlParameter("foo", NpgsqlDbType.Varchar);
            p.Value = DateTime.MaxValue;
            p.ResetDbType();
            Assert.AreEqual(DbType.DateTime, p.DbType, "#F:DbType");
            Assert.AreEqual(NpgsqlDbType.Timestamp, p.NpgsqlDbType, "#F:NpgsqlDbType");
            Assert.AreEqual(DateTime.MaxValue, p.Value, "#F:Value");

            p = new NpgsqlParameter("foo", NpgsqlDbType.Varchar);
            p.Value = DBNull.Value;
            p.ResetDbType();
            Assert.AreEqual(DbType.String, p.DbType, "#G:DbType");
            Assert.AreEqual(NpgsqlDbType.Text, p.NpgsqlDbType, "#G:NpgsqlDbType");
            Assert.AreEqual(DBNull.Value, p.Value, "#G:Value");

            p = new NpgsqlParameter("foo", NpgsqlDbType.Varchar);
            p.Value = null;
            p.ResetDbType();
            Assert.AreEqual(DbType.String, p.DbType, "#G:DbType");
            Assert.AreEqual(NpgsqlDbType.Text, p.NpgsqlDbType, "#G:NpgsqlDbType");
            Assert.IsNull(p.Value, "#G:Value");
        }