Exemplo n.º 1
0
        public void UpdateTestRun()
        {
            var queries = Helpers.GetQueries(Properties.Resources.UpdateTestQueries);

            Assert.AreEqual(6, queries.Length);

            using (var connection = Helpers.GetJetConnection())
            {
                connection.Open();
                DbDataReader reader;
                for (int index = 0; index < queries.Length - 2; index++)
                {
                    string query = queries[index];
                    reader = Helpers.Execute(connection, query);
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                }
                reader = Helpers.Execute(connection, queries[4]);
                reader.Read();
                Assert.AreEqual(1, reader.GetInt32(0));
                reader.Dispose();

                Helpers.Execute(connection, queries[5]);
            }
        }
Exemplo n.º 2
0
        public void UpdateTestWithTransactionsRun()
        {
            JetConfiguration.ShowSqlStatements = true;

            var queries = Helpers.GetQueries(Properties.Resources.UpdateTestQueries);

            Assert.AreEqual(6, queries.Length);

            using (var connection = Helpers.GetJetConnection())
            {
                connection.Open();
                DbDataReader reader;
                for (int index = 0; index < queries.Length - 2; index++)
                {
                    DbTransaction transaction = connection.BeginTransaction();
                    string        query       = queries[index];
                    reader = Helpers.Execute(connection, transaction, query);
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                    transaction.Commit();
                }
                reader = Helpers.Execute(connection, queries[4]);
                reader.Read();
                Assert.AreEqual(1, reader.GetInt32(0));
                reader.Dispose();

                Helpers.Execute(connection, queries[5]);
            }
        }
        public void CheckIfTablesExists()
        {
            var queries = Helpers.GetQueries(System.Data.Jet.Test.Properties.Resources.CheckIfTableExistsTestQueries);

            using (var connection = Helpers.GetJetConnection())
            {
                connection.Open();
                Helpers.Execute(connection, queries[0]);

                bool exists = ((JetConnection)AssemblyInitialization.Connection).TableExists("CheckIfTableExistsTable");
                Assert.IsTrue(exists);

                Helpers.Execute(connection, queries[1]);
            }
        }
Exemplo n.º 4
0
        public void InsertTestRun()
        {
            var queries = Helpers.GetQueries(Properties.Resources.InsertTestQueries);

            Assert.AreEqual(4, queries.Length);

            using (var connection = Helpers.GetJetConnection())
            {
                connection.Open();
                DbDataReader reader;
                for (int index = 0; index < queries.Length - 1; index++)
                {
                    string query = queries[index];
                    reader = Helpers.Execute(connection, query);
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                }


                Helpers.Execute(connection, queries[3]);
            }
        }