public void Test_IsolationLevel_MySQL()
 {
     //---------------Execute Test ----------------------
     DatabaseConnection conn =
         new DatabaseConnectionMySql("MySql.Data", "MySql.Data.MySqlClient.MySqlConnection");
     //---------------Test Result -----------------------
     Assert.AreEqual(IsolationLevel.RepeatableRead, conn.IsolationLevel);
 }
 public void Test_CreateDatabaseConnection_MySQL()
 {
     DatabaseConnection conn = new DatabaseConnectionMySql
         ("MySql.Data", "MySql.Data.MySqlClient.MySqlConnection");
     conn.ConnectionString =
         new DatabaseConfig(DatabaseConfig.MySql, "test", "test", "test", "test", "1000").GetConnectionString();
     Assert.AreEqual
         ("MySql.Data.MySqlClient", conn.TestConnection.GetType().Namespace,
          "Namespace of mysqlconnection is wrong.");
 }
 public void TestCreateParameterNameGenerator()
 {
     //---------------Set up test pack-------------------
     IDatabaseConnection databaseConnection = new DatabaseConnectionMySql("", "");
     //---------------Assert PreConditions---------------            
     //---------------Execute Test ----------------------
     IParameterNameGenerator generator = databaseConnection.CreateParameterNameGenerator();
     //---------------Test Result -----------------------
     Assert.AreEqual("?", generator.PrefixCharacter);
     //---------------Tear Down -------------------------          
 }
 public void TestCreateParameterNameGenerator()
 {
     //---------------Set up test pack-------------------
     IDatabaseConnection databaseConnection = new DatabaseConnectionMySql("", "");
     //---------------Assert PreConditions---------------            
     //---------------Execute Test ----------------------
     IParameterNameGenerator generator = databaseConnection.CreateParameterNameGenerator();
     //---------------Test Result -----------------------
     Assert.IsNotNull(generator);
     Assert.AreEqual("?Param0", generator.GetNextParameterName());
     //---------------Tear Down -------------------------          
 }
        public void Test_CreateCustomConnectionString()
        {
            //---------------Set up test pack-------------------
            string connectString = "";
            DatabaseConnection databaseConnection = new DatabaseConnectionMySql("", "", connectString);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            string setConnectionString = databaseConnection.ConnectionString;

            //---------------Test Result -----------------------
            Assert.AreEqual(setConnectionString, connectString);
        }
        public void TestSqlFormatter()
        {
            //---------------Set up test pack-------------------
            DatabaseConnection databaseConnection = new DatabaseConnectionMySql("", "");
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            ISqlFormatter defaultSqlFormatter = databaseConnection.SqlFormatter;
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(SqlFormatter), defaultSqlFormatter);
            SqlFormatter formatter = (SqlFormatter)defaultSqlFormatter;
            Assert.AreEqual("`", formatter.LeftFieldDelimiter);
            Assert.AreEqual("`", formatter.RightFieldDelimiter);
            Assert.AreEqual("", formatter.LimitClauseAtBeginning);
            Assert.AreEqual("LIMIT", formatter.LimitClauseAtEnd);

        }