public void Main_Exception_Shows_First_Exception()
        {
            _info.SetExceptions(new List <Exception>
            {
                new Exception("test1"),
                new Exception("test2")
            });

            Assert.That(_info.MainException.Message, Is.EqualTo("test1"));
        }
Exemplo n.º 2
0
 public ExceptionReportView(params Exception[] e)
 {
     InitializeComponent();
     reportInfo.SetExceptions(e);
     //ShowFullDetail();
     ShowLastReportInfot(reportInfo);
     presenter = new ExceptionReportPresenter(reportInfo);
 }
 /// <summary>
 /// Show the ExceptionReport dialog
 /// </summary>
 /// <remarks>The <see cref="ExceptionReporter"/> will analyze the <see cref="Exception"/>s and
 /// create and show the report dialog.</remarks>
 /// <param name="exceptions">The <see cref="Exception"/>s to show.</param>
 public void Show(params Exception[] exceptions)
 {
     if (exceptions == null)
     {
         return;                     //TODO perhaps show a dialog that says "No exception to show" ?
     }
     try
     {
         _reportInfo.SetExceptions(exceptions);
         _view = new ExceptionReportView(_reportInfo);
         _view.ShowExceptionReport();
     }
     catch (Exception internalException)
     {
         MessageBox.Show(internalException.Message, "Error Reporting Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 4
0
        public ErrorReportViewModel(IEnumerable<Exception> exceptions)
        {
            Model = new ExceptionReportInfo { AppAssembly = Assembly.GetCallingAssembly() };
            Model.SetExceptions(exceptions);

            CopyCommand = new CaptionCommand<string>(Resources.Copy, OnCopyCommand);
            SaveCommand = new CaptionCommand<string>(Resources.Save, OnSaveCommand);
            SubmitCommand = new CaptionCommand<string>(Resources.Send, OnSubmitCommand);
        }
Exemplo n.º 5
0
        public void Can_Create_Subject_Without_CrLf()
        {
            var reportInfo = new ExceptionReportInfo();

            reportInfo.SetExceptions(new[] { new Exception("hello\r\nagain") });
            var mailSender = new MapiMailSender(reportInfo, null);

            Assert.That(mailSender.EmailSubject, Does.Not.Contain("\r"));
            Assert.That(mailSender.EmailSubject, Does.Not.Contain("\n"));
        }
        public ErrorReportViewModel(IEnumerable <Exception> exceptions)
        {
            Model = new ExceptionReportInfo {
                AppAssembly = Assembly.GetCallingAssembly()
            };
            Model.SetExceptions(exceptions);

            CopyCommand   = new CaptionCommand <string>(Resources.Copy, OnCopyCommand);
            SaveCommand   = new CaptionCommand <string>(Resources.Save, OnSaveCommand);
            SubmitCommand = new CaptionCommand <string>(Resources.Send, OnSubmitCommand);
        }
Exemplo n.º 7
0
        public void Can_Create_Subject()
        {
            var exception  = new Exception("hello");
            var reportInfo = new ExceptionReportInfo {
                TitleText = "test"
            };

            reportInfo.SetExceptions(new[] { exception });
            var mailSender = new MapiMailSender(reportInfo, null);

            Assert.That(mailSender.EmailSubject, Is.EqualTo("hello"));
        }
        public void Can_Use_Custom_Subject()
        {
            var exception  = new Exception("Exception");
            var reportInfo = new ExceptionReportInfo {
                TitleText = "test"
            };

            reportInfo.SetExceptions(new[] { exception });
            reportInfo.EmailReportSubject = "hello";
            var mailSender = new MapiMailSender(reportInfo, null, new Mock <IScreenShooter>().Object);

            Assert.That(mailSender.EmailSubject, Is.EqualTo("hello"));
        }
Exemplo n.º 9
0
 /// <summary>
 /// Show the ExceptionReport dialog
 /// </summary>
 /// <remarks>The <see cref="ExceptionReporter"/> will analyze the <see cref="Exception"/>s and
 /// create and show the report dialog.</remarks>
 /// <param name="exceptions">The <see cref="Exception"/>s to show.</param>
 // ReSharper disable MemberCanBePrivate.Global
 public void Show(params Exception[] exceptions)
 {
     if (exceptions == null)
     {
         return;                     //TODO perhaps show a dialog that says "No exception to show" ?
     }
     try
     {
         _reportInfo.SetExceptions(exceptions);
         _view = ViewFactory.Create <IExceptionReportView>(_viewResolver, _reportInfo);
         _view.ShowExceptionReport();
     }
     catch (Exception internalException)
     {
         _internalExceptionView.ShowException("Unable to show Exception Report", internalException);
     }
 }