private void CallbackSaveBrokenLinksCsvReport(
            object sender,
            EventArgs e,
            MacroscopeCsvBrokenLinksReport.OutputWorksheet SelectedOutputWorksheet,
            string OutputFilename
            )
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "csv";
            Dialog.AddExtension     = true;
            Dialog.FileName         = OutputFilename;

            this.Enabled = false;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;
                MacroscopeCsvBrokenLinksReport CsvReport = new MacroscopeCsvBrokenLinksReport();

                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    CsvReport.WriteCsv(
                        JobMaster: this.JobMaster,
                        SelectedOutputWorksheet: SelectedOutputWorksheet,
                        OutputFilename: Path
                        );

                    Cursor.Current = Cursors.Default;
                }
                catch (MacroscopeSaveCsvFileException ex)
                {
                    this.DialogueBoxError("Error saving Broken Links CSV Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Broken Links CSV Report", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            if (Dialog != null)
            {
                Dialog.Dispose();
            }

            this.Enabled = true;
        }
        public void TestWriteCsv()
        {
            MacroscopeJobMaster            JobMaster  = new MacroscopeJobMaster(MacroscopeConstants.RunTimeMode.LIVE);
            MacroscopeCsvBrokenLinksReport ReportFile = new MacroscopeCsvBrokenLinksReport();
            List <MacroscopeCsvBrokenLinksReport.OutputWorksheet> SelectedOutputWorksheets = new List <MacroscopeCsvBrokenLinksReport.OutputWorksheet>();

            SelectedOutputWorksheets.Add(MacroscopeCsvBrokenLinksReport.OutputWorksheet.BROKEN_LINKS);
            SelectedOutputWorksheets.Add(MacroscopeCsvBrokenLinksReport.OutputWorksheet.GOOD_LINKS);
            SelectedOutputWorksheets.Add(MacroscopeCsvBrokenLinksReport.OutputWorksheet.REDIRECTED_LINKS);
            foreach (MacroscopeCsvBrokenLinksReport.OutputWorksheet SelectedOutputWorksheet in SelectedOutputWorksheets)
            {
                string Filename = string.Join(".", Path.GetTempFileName(), ".csv");
                ReportFile.WriteCsv(JobMaster: JobMaster, SelectedOutputWorksheet: SelectedOutputWorksheet, OutputFilename: Filename);
                Assert.IsTrue(File.Exists(Filename));
                File.Delete(Filename);
            }
        }