Beispiel #1
0
        public override void TestDbOperations()
        {
            string fileName = Path.Combine(_tempDirectory, _tempFilePrefix + "-Odbc-TestDbOps.mdb");
            OdbcDba odbcDba = null;

            try {
                CreateDb(fileName);

                odbcDba = new OdbcDba();
                odbcDba.ConnectMDB(fileName);

                PopulateDb(odbcDba);

                odbcDba.ExecuteSqlCommand(_sqlDropTable);
            }
            finally
            {
                if (odbcDba != null && odbcDba.Connected) {
                    odbcDba.Disconnect();
                    odbcDba.Dispose();
                }
                File.Delete(fileName);
                Assert.IsFalse(File.Exists(fileName), "Failed to delete " + fileName);
            }
        }
Beispiel #2
0
        public override void TestProcedureSupport()
        {
            string fileName = Path.Combine(_tempDirectory, _tempFilePrefix + "-Odbc-TestProcedures.mdb");
            OdbcDba odbcDba = null;

            try {
                CreateDb(fileName);

                odbcDba = new OdbcDba();
                try {
                    Assert.IsTrue(odbcDba.SupportsProcedures);
                    Assert.Fail("OdbcDba.SupportsProcedures should throw a InvalidOperationException if no database is connected.");
                }
                catch(InvalidOperationException) {}

                odbcDba.ConnectMDB(fileName);
                Assert.IsTrue(odbcDba.SupportsProcedures);
            }
            finally
            {
                if (odbcDba != null && odbcDba.Connected)
                {
                    odbcDba.Disconnect();
                    odbcDba.Dispose();
                }
                File.Delete(fileName);
                Assert.IsFalse(File.Exists(fileName), "Failed to delete " + fileName);
            }
        }