Esempio n. 1
0
        private static void PrintSQL(DbCommand command)
        {
            if (Loggi.DebugEnabled)
            {
                StringBuilder sqlText = new StringBuilder();
                foreach (DbParameter parameter in command.Parameters)
                {
                    if (sqlText.Length == 0)
                    {
                        sqlText.Append(command.CommandText).Append(" - ");
                    }
                    else
                    {
                        sqlText.Append(", ");
                    }
                    sqlText.Append(parameter.Value);
                }

                if (sqlText.Length == 0)
                {
                    sqlText.Append(command.CommandText);
                }
                Loggi.Debug("SQL: " + sqlText.ToString());
            }
        }
        private void InitializeProvider(string databaseName)
        {
            ConnectionStringSettings settings;

            if (DatabaseConnection.Default.Equals(databaseName))
            {
                if (DatabaseConnectionManager.ConnectionStrings.Count == 0)
                {
                    throw new ConfigException("M_Fixture_Temp_DatabaseConnection_NoConnectionSettings");
                }
                settings = DatabaseConnectionManager.ConnectionStrings[0];
            }
            else
            {
                settings = DatabaseConnectionManager.Find(databaseName);
                if (settings == null)
                {
                    throw new ConfigException("M_Fixture_Temp_DatabaseConnection_NoSuchName", databaseName);
                }
            }

            provider         = settings.ProviderName;
            connectionString = settings.ConnectionString;
            Loggi.Debug("Connection: " + settings.Name + ", providerName=" + provider + ", connectionString=" + connectionString);

            factory = DbProviderFactories.GetFactory(provider);
            if (provider.IndexOf("Oracle") > -1)
            {
                parameterPrefix = ':';
            }
            else
            {
                IsSQLServer = true;
            }
        }
Esempio n. 3
0
        public void Validate <TException>(Action action, string typeName) where TException : Exception
        {
            bool isNormalEnd = false;

            try
            {
                action();
                isNormalEnd = true;
            }
            catch (TException e)
            {
                Loggi.Debug(e);
                object   obj    = e;
                Delegate editor = GetExceptionEditor(e.GetType());
                if (editor != null)
                {
                    obj = editor.DynamicInvoke(e);
                }
                Validate(obj, typeName);
            }

            if (isNormalEnd)
            {
                Assertie.Fail("M_Fixture_Temp_ObjectValidator_Exception", typeof(TException).Name);
            }
        }
Esempio n. 4
0
 private void Initialize(FixtureInfo fixtureInfo)
 {
     book     = Book.GetInstance(fixtureInfo.FilePath);
     sheet    = book.GetSheet(fixtureInfo.SheetName);
     testCase = sheet.GetCase(fixtureInfo.TestCaseName);
     Loggi.Debug("FixtureBook : Case : " + testCase);
 }
Esempio n. 5
0
 private void Output(string cellReference, string formattedValue)
 {
     if (cellParser.DebugEnabled)
     {
         Loggi.Debug("[" + cellReference + "]" + formattedValue);
     }
     cellParser.Parse(ToRow(cellReference), ToColumn(cellReference), formattedValue);
 }
Esempio n. 6
0
        public void Debug_stringはDebugEnabledがfalseの場合ログ出力を行わない()
        {
            // setup
            Loggi.DebugEnabled = false;

            // when
            Loggi.Debug("aaa");

            // then
            traceListener.AssertMessage(null, null, null);
        }
Esempio n. 7
0
        public void Debug_stringはDebugEnabledがtrueの場合ログ出力を行う()
        {
            // setup
            Loggi.DebugEnabled = true;

            // when
            Loggi.Debug("aaa");

            // then
            traceListener.AssertMessage(null, "aaa", null);
        }
Esempio n. 8
0
 private void Initialize(Type testClass, string bookPath, string sheetName, string testCaseName)
 {
     this.testClass = testClass;
     this.book      = Book.GetInstance(testClass, bookPath);
     this.sheet     = book.GetSheet(sheetName);
     this.testCase  = sheet.GetCase(testCaseName);
     foreach (Type exceptionType in defaultExceptionEditors.Keys)
     {
         this.testCase.RegisterExceptionEditor(exceptionType, defaultExceptionEditors[exceptionType]);
     }
     Loggi.Debug("FixtureBook : Case : " + this.testCase);
 }
Esempio n. 9
0
 private object DynamicInvoke(Delegate action, Type[] types)
 {
     try
     {
         return(action.DynamicInvoke(GetParameters(types)));
     }
     catch (TargetInvocationException e)
     {
         Loggi.Debug(e);
         throw e.InnerException;
     }
 }
Esempio n. 10
0
 private object DynamicInvoke(Type targetClass, string targetMethod, Type[] targetMethodParameter)
 {
     try
     {
         return(DynamicInvokeInternal(targetClass, targetMethod, targetMethodParameter));
     }
     catch (TargetInvocationException e)
     {
         Loggi.Debug(e);
         throw e.InnerException;
     }
 }
Esempio n. 11
0
        public void Debug_string_ExceptionはDebugEnabledがfalseの場合ログ出力を行わない()
        {
            // setup
            Loggi.DebugEnabled = false;
            try
            {
                throwException("eee");
            }
            catch (Exception e)
            {
                // when
                Loggi.Debug("aaa", e);

                // then
                traceListener.AssertMessage(null, null, null);
            }
        }
Esempio n. 12
0
        public void Debug_ExceptionはDebugEnabledがtrueの場合ログ出力を行う()
        {
            // setup
            Loggi.DebugEnabled = true;
            try
            {
                throwException("aaa");
            }
            catch (Exception e)
            {
                // when
                Loggi.Debug(e);

                // then
                traceListener.AssertMessage(null, "aaa", e);
            }
        }
Esempio n. 13
0
        public override void Validate <TException>(Action action, string typeName)
        {
            bool isNormalEnd = false;

            try
            {
                action();
                isNormalEnd = true;
            }
            catch (TException e)
            {
                Loggi.Debug(e);
                Validate(e, typeName);
            }

            if (isNormalEnd)
            {
                Assertie.Fail("M_Fixture_Temp_ObjectValidator_Exception", typeof(TException).Name);
            }
        }