Пример #1
0
        //application routines
        private void RunTests()
        {
            int numberOfTests = 0;

            _outputStackTraceWithErrorMessages = this.chkShowStackTraceOnError.Checked;
            Tests.MainForm = this;

            try
            {
                DisableFormControls();
                Tests.SaveErrorMessagesToAppLog = _saveErrorMessagesToAppLog;

                if (this.chkEraseOutputBeforeEachTest.Checked)
                {
                    Program._messageLog.Clear();
                }

                if (this.chkShowDateTimeTest.Checked)
                {
                    numberOfTests++;
                    Tests.RunShowDateTimeTest();
                }

                if (this.chkGetStaticKeysTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("GetStaticKeysTest");
                    Tests.GetStaticKeys();
                    OutputTestFinishedMessageToLog("GetStaticKeysTest");
                }


                if (this.chkConnectionStringTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("ConnectionStringTest");
                    Tests.ConnectionStringTest();
                    OutputTestFinishedMessageToLog("ConnectionStringTest");
                }
                if (this.chkCreateTableTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("CreateTableTest");
                    Tests.CreateTableTest();
                    OutputTestFinishedMessageToLog("CreateTableTest");
                }
                if (this.chkDataReaderTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("DataReaderTest");
                    Tests.DataReaderTest();
                    OutputTestFinishedMessageToLog("DataReaderTest");
                }
                if (this.chkDataReaderToDataTableTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("DataReaderToDataTableTest");
                    Tests.DataReaderToDataTableTest();
                    OutputTestFinishedMessageToLog("DataReaderToDataTableTest");
                }
                if (this.chkDataTableTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("DataTableTest");
                    Tests.DataTableTest();
                    OutputTestFinishedMessageToLog("DataTableTest");
                }
                if (this.chkDataSetTest.Checked)
                {
                    numberOfTests++;
                    OutputTestRunningMessageToLog("DataSetTest");
                    Tests.DataSetTest();
                    OutputTestFinishedMessageToLog("DataSetTest");
                }
                if (this.chkGetSchemaTest.Checked)
                {
                    numberOfTests++;
                    Tests.GetSchemaTest();
                }
                if (this.chkImportDataTable.Checked)
                {
                    numberOfTests++;
                    Tests.ImportDataTableTest();
                }


                if (numberOfTests == 0)
                {
                    AppMessages.DisplayInfoMessage("No tests selected ...", false);
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                EnableFormControls();
                _msg.Length = 0;
                _msg.Append("\r\n");
                _msg.Append("Number of tests run: ");
                _msg.Append(numberOfTests.ToString("#,##0"));
                Program._messageLog.WriteLine(_msg.ToString());
            }
        }