/// <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 Test_ExecuteScripts_TwoFileContent_WithGo()
        {
            const string fileContent = @"create table BackendUser (BackendUserId int, Username nvarchar(30))
                                  go
                                  create table Company (CompanyId int, Name nvarchar(30))
                                 go";
            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()).Returns(dbCommandMock.Object);

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

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

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

            Assert.Equal(expectedResult, actualResult);
        }
        public void Test_ExecuteScripts_OneFileContent_WithoutGo()
        {
            const string fileContent = "MsSQL 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()).Returns(dbCommandMock.Object);

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

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

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

            Assert.Equal(expectedResult, actualResult);
        }
        public void Test_GetChangeLogTableScript()
        {
            IDbProvider provider = new MsSqlDbProvider(new MySqlDatabase());
            var actualString = provider.GetChangeLogTableScript();
            const string expectedString = Constants.ChangeLogTableScripts.MsSqlChangeLogTable;

            Assert.Equal(expectedString, actualString);
        }