/// <summary>
        /// Gets database provider.
        /// </summary>
        /// <returns><see cref="Vega.DbUpgrade.Interfaces.IDbProvider"/> object.</returns>
        public static IDbProvider GetDbProvider()
        {
            IDbProvider retVal = null;

            string providerName = ConfigurationManager.AppSettings[Constants.AppSettingKeys.DatabaseProvider];
            if (!String.IsNullOrEmpty(providerName))
            {
                if (Enum.IsDefined(typeof(DBProviders), providerName.ToLower()))
                {
                    var provider = (DBProviders)Enum.Parse(typeof(DBProviders), providerName, true);
                    switch (provider)
                    {
                        case DBProviders.mssql:
                            retVal = new MsSqlDbProvider(new MsSqlDatabase());
                            break;
                        case DBProviders.mysql:
                            retVal = new MySqlDbProvider(new MySqlDatabase());
                            break;
                        case DBProviders.firebird:
                            retVal = new FireBirdDbProvider(new FirebirdDatabase());
                            break;
                    }
                }
            }

            return retVal;
        }
        public void MySql_Test_GetChangeLogTableScript()
        {
            IDbProvider provider = new MySqlDbProvider(new MySqlDatabase());
            var actualString = provider.GetChangeLogTableScript();
            const string expectedString = Constants.ChangeLogTableScripts.MySqlChangeLogTable;

            Assert.Equal(expectedString, actualString);
        }
        public void MySql_Test_ExecuteScripts_TwoFileContent()
        {
            const string fileContent = @"create table BackendUser (BackendUserId int, Username nvarchar(30)); insert into BackendUser values(1, ""I must go home.""));";
            const bool expectedResult = true;

            var dbConnectionMock = new Mock<IDbConnection>();
            var databaseMock = new Mock<IDatabase>();
            var dbCommandMock = new Mock<IDbCommand>();

            databaseMock.Setup(t => t.GetDbConnection()).Returns(dbConnectionMock.Object);
            databaseMock.Setup(t => t.GetDbCommand(fileContent, dbConnectionMock.Object)).Returns(dbCommandMock.Object);

            dbConnectionMock.Setup(t => t.Open());
            dbCommandMock.Setup(t => t.ExecuteNonQuery());

            IDbProvider provider = new MySqlDbProvider(databaseMock.Object);
            var actualResult = provider.ExecuteScript(fileContent);

            dbCommandMock.VerifyAll();
            databaseMock.VerifyAll();
            dbCommandMock.VerifyAll();

            Assert.Equal(expectedResult, actualResult);
        }
        public void MySql_Test_ExecuteScripts_FileContentExecuted()
        {
            const string fileContent = "MySQL Script";
            const bool expectedResult = true;

            var dbConnectionMock = new Mock<IDbConnection>();
            var databaseMock = new Mock<IDatabase>();
            var dbCommandMock = new Mock<IDbCommand>();

            databaseMock.Setup(t => t.GetDbConnection()).Returns(dbConnectionMock.Object);
            databaseMock.Setup(t => t.GetDbCommand(fileContent, dbConnectionMock.Object)).Returns(dbCommandMock.Object);

            dbConnectionMock.Setup(t => t.Open());
            dbCommandMock.Setup(t => t.ExecuteNonQuery());

            IDbProvider provider = new MySqlDbProvider(databaseMock.Object);
            var actualResult = provider.ExecuteScript(fileContent);

            dbCommandMock.VerifyAll();
            databaseMock.VerifyAll();
            dbCommandMock.VerifyAll();

            Assert.Equal(expectedResult, actualResult);
        }