示例#1
0
        public void PqsqlConnectionTest1()
        {
            PqsqlConnection connection = new PqsqlConnection(string.Empty);

            Assert.AreEqual(ConnectionState.Closed, connection.State, "wrong connection state");
            Assert.AreEqual(string.Empty, connection.ConnectionString, "wrong connection string");
            Assert.AreEqual(0, connection.ConnectionTimeout, "wrong connection timeout");
            Assert.AreEqual(string.Empty, connection.Database, "wrong connection database");

            connection.ConnectionString = connectionString;

            connection.Open();
            Assert.AreEqual(ConnectionState.Open, connection.State, "wrong connection state");

            connection.ChangeDatabase("postgres");
            Assert.AreEqual("postgres", connection.Database, "wrong connection database");

            connection.Open();
            Assert.AreEqual(ConnectionState.Open, connection.State, "wrong connection state");

            connection.Open();
            Assert.AreEqual(ConnectionState.Open, connection.State, "wrong connection state");

            ExecStatusType status = connection.Exec(null);

            Assert.AreEqual(ExecStatusType.PGRES_FATAL_ERROR, status);

            IntPtr res;

            status = connection.Exec(null, out res);
            Assert.AreEqual(ExecStatusType.PGRES_FATAL_ERROR, status);
            Assert.AreEqual(IntPtr.Zero, res);
            connection.Consume(res);

            connection.Dispose();
            connection.Dispose();
        }
示例#2
0
 public void TestCleanup()
 {
     mCmd.Dispose();
     mConnection.Dispose();
 }