Exemple #1
0
        private void btnRunGroup_Activate(object sender, EventArgs e)
        {
            _auditTesting = new AuditTesting(_auditController.AuditGroup);

            // Wire up the events
            _auditTesting.AuditTestingStarting += _auditTesting_AuditTestingStarting;
            _auditTesting.CurrentAuditRunning += _auditTesting_CurrentAuditRunning;
            _auditTesting.CurrentAuditDone += _auditTesting_CurrentAuditDone;

            XpLinkRun.Enabled = false;
            btnRunGroup.Enabled = false;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                _auditTesting.RunAudits();

                AuditUtils.SendResult(_auditTesting.Audits);
            }
            catch (NoAuditsLoadedException ex)
            {
                MessageBox.Show("There are no audits to run!", "No Audits", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (System.Net.Mail.SmtpException mailSmtpException)
            {
                this.Refresh();

                // Change the icon to the "paused" icon
                foreach (ListViewItem objItem in lsvAudits.Items)
                {
                    objItem.ImageIndex = 4;
                    objItem.SubItems[2].Text = "Email Failure";
                    this.Refresh();
                }

                MessageBox.Show(mailSmtpException.Message, "NAudit Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                this.Refresh();

                // Change the icon to the "paused" icon
                foreach (ListViewItem objItem in lsvAudits.Items)
                {
                    objItem.ImageIndex = 4;
                    objItem.SubItems[2].Text = "Failure";
                    this.Refresh();
                }

                MessageBox.Show(ex.Message, "NAudit Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            finally
            {
                this.Cursor = Cursors.Default;
                XpLinkRun.Enabled = true;
                btnRunGroup.Enabled = true;
            }
        }
Exemple #2
0
        private static void ProcessAudits(string auditGroupFile)
        {
            var colAudits = new AuditController(auditGroupFile);

            _auditTesting = new AuditTesting(colAudits.AuditGroup);

            // Wire up the events
            _auditTesting.AuditTestingStarting += _auditTesting_AuditTestingStarting;
            _auditTesting.CurrentAuditRunning  += _auditTesting_CurrentAuditRunning;
            _auditTesting.CurrentAuditDone     += _auditTesting_CurrentAuditDone;

            _auditTesting.RunAudits();

            Console.WriteLine("DataAuditor ran {0} test(s).", _auditTesting.Audits.Count);

            // Try Unit Test Type report until the rest gets sorted out
            //AuditUtils.SendResult(colAudits.AuditGroup);
            AuditUtils.SendResult(colAudits.AuditGroup);

            Console.WriteLine("Sent results email to recipients.");
        }