public void TestCompactMdb() { string fileName = Path.Combine(_tempDirectory, _tempFilePrefix + ".mdb"); OleDba oleDba = null; try { CreateMdb(fileName); oleDba = new OleDba(); oleDba.ConnectMDB(fileName); PopulateOleDba(oleDba); oleDba.Disconnect(); JetSqlUtil.CompactMDB(fileName); oleDba.ConnectMDB(); oleDba.ExecuteSqlCommand(_sqlDropTable); oleDba.Disconnect(); } finally { if (oleDba != null && oleDba.Connected) { oleDba.Disconnect(); oleDba.Dispose(); } File.Delete(fileName); Assert.IsFalse(File.Exists(fileName), "Failed to delete " + fileName); } }
public void TestProcedureSupport() { string fileBaseName = Path.Combine(_tempDirectory, _tempFilePrefix); OleDba oleDba = null; try { CreateMdb(fileBaseName + ".mdb"); oleDba = new OleDba(); try { Assert.IsTrue(oleDba.SupportsProcedures); Assert.Fail("OleDba.SupportsProcedures should throw a InvalidOperationException if no database is connected."); } catch (InvalidOperationException) {} oleDba.ConnectMDB(fileBaseName + ".mdb"); Assert.IsTrue(oleDba.SupportsProcedures);; } finally { if (oleDba != null && oleDba.Connected) { oleDba.Disconnect(); oleDba.Dispose(); } File.Delete(fileBaseName + ".mdb"); Assert.IsFalse(File.Exists(fileBaseName + ".mdb"), "Failed to delete " + fileBaseName + ".mdb"); } }