示例#1
0
        private void RunSingleAudit()
        {
            _auditTesting = new AuditTesting();
            bool result = false;

            // Wire events
            _auditTesting.CurrentSingleAuditRunning += _auditTesting_CurrentSingleAuditRunning;
            _auditTesting.CurrentSingleAuditDone += _auditTesting_CurrentSingleAuditDone;

            var currentAudit = (Audit)lsvAudits.Items[_selectedIndex].Tag;

            this.Refresh();

            _auditTesting.RunAudit(ref currentAudit);
        }
示例#2
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;
            }
        }
        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);
        }