Ejemplo n.º 1
0
        private void XpLinkRun_Click(object sender, System.EventArgs e)
        {
            _auditTesting = new AuditTesting(_audits.AuditGroup);

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

            try
            {
                this.Cursor = Cursors.WaitCursor;
                _auditTesting.RunAudits();
            }
            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;
            }
        }
Ejemplo n.º 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);
        }