Esempio n. 1
0
 public virtual void VisitException(ReportException exception)
 {
     if (exception.Exception != null)
     {
         VisitException(exception.Exception);
     }
 }
		public ReportExceptionException(string message,ReportException exception)
			:base(message)
		{
			if (exception==null)
				throw new ArgumentNullException("exception");
			this.exception=exception;
		}
Esempio n. 3
0
        public static ReportException FromException(Exception ex)
        {
            if (ex == null)
            {
                throw new ArgumentNullException("ex");
            }

            ReportException rex = new ReportException();

            if (ex.GetType() == typeof(TargetInvocationException) && ex.InnerException != null)
            {
                ex = ex.InnerException;
            }

            rex.Type       = ex.GetType().ToString();
            rex.Message    = String.Format("{0}", ex.Message);
            rex.Source     = String.Format("{0}", ex.Source);
            rex.StackTrace = ex.StackTrace;
            if (ex.InnerException != null)
            {
                rex.Exception = FromException(ex.InnerException);
            }
            foreach (PropertyInfo property in ex.GetType().GetProperties())
            {
                if (property.Name == "Message" ||
                    property.Name == "Source" ||
                    property.Name == "StackTrace" ||
                    property.Name == "InnerException" ||
                    property.Name == "Data")
                {
                    continue;
                }

                ReportProperty p = new ReportProperty(ex, property);
                rex.Properties.AddReportProperty(p);
            }

            /*
             * if (ex.Data!=null)
             * {
             *  foreach (DictionaryEntry de in ex.Data)
             *  {
             *      ReportProperty p = new ReportProperty(de);
             *      rex.Properties.Add(p);
             *  }
             * }
             */

            return(rex);
        }
Esempio n. 4
0
        public static ReportRun Skip(RunPipe pipe, Exception ex)
        {
            ReportRun run = new ReportRun();

            run.Result      = ReportRunResult.Skip;
            run.Name        = pipe.Name;
            run.Duration    = 0;
            run.Memory      = 0;
            run.AssertCount = MbUnit.Framework.Assert.AssertCount;
            run.Exception   = ReportException.FromException(ex);

            MbUnit.Framework.Assert.FlushWarnings(run);

            return(run);
        }
Esempio n. 5
0
        public static ReportRun Failure(RunPipe pipe, ReportMonitor monitor, Exception ex)
        {
            ReportRun run = new ReportRun();

            run.ConsoleOut   = monitor.Consoler.Out;
            run.ConsoleError = monitor.Consoler.Error;
            run.Result       = ReportRunResult.Failure;
            run.Name         = pipe.Name;
            run.AssertCount  = MbUnit.Framework.Assert.AssertCount;
            run.Duration     = monitor.Timer.Duration;
            run.Memory       = monitor.Memorizer.Usage;
            run.Exception    = ReportException.FromException(ex);

            MbUnit.Framework.Assert.FlushWarnings(run);

            return(run);
        }
Esempio n. 6
0
        private ReportException CreateException(Exception ex)
        {
            ReportException rex = new ReportException();

            if (ex.GetType() == typeof(TargetInvocationException) && ex.InnerException != null)
            {
                ex = ex.InnerException;
            }

            rex.Type       = ex.GetType().ToString();
            rex.Message    = ex.Message;
            rex.Source     = ex.Source;
            rex.StackTrace = ex.StackTrace;
            if (ex.InnerException != null)
            {
                rex.Exception = CreateException(ex.InnerException);
            }

            return(rex);
        }
		static ExceptionInfo GetExceptionInfo(ReportException reportException)
		{
			if (reportException == null)
			{
				return null;
			}

			ExceptionInfo exceptionInfo = new ExceptionInfo();
			exceptionInfo.Type = reportException.Type;
			exceptionInfo.Message = reportException.Message;
			exceptionInfo.Source = reportException.Source;
			exceptionInfo.StackTrace = reportException.StackTrace;

			if (reportException.Exception != null)
			{
				exceptionInfo.InnerException = GetExceptionInfo(reportException.Exception);
			}

			return exceptionInfo;
		}
        private ReportException CreateException(Exception ex)
        {
            ReportException rex = new ReportException();

            if (ex.GetType() == typeof(TargetInvocationException) && ex.InnerException!=null)
                ex = ex.InnerException;

            rex.Type = ex.GetType().ToString();
            rex.Message  = ex.Message;
            rex.Source = ex.Source;
            rex.StackTrace = ex.StackTrace;
            if (ex.InnerException!=null)
                rex.Exception = CreateException(ex.InnerException);

            return rex;
        }
        public static ReportException FromException(Exception ex)
        {
            if (ex==null)
                throw new ArgumentNullException("ex");

            ReportException rex = new ReportException();

            if (ex.GetType() == typeof(TargetInvocationException) && ex.InnerException!=null)
                ex = ex.InnerException;

            rex.Type = ex.GetType().ToString();
            rex.Message  = String.Format("{0}",ex.Message);
            rex.Source = String.Format("{0}",ex.Source);
            rex.StackTrace = ex.StackTrace;
            if (ex.InnerException!=null)
                rex.Exception = FromException(ex.InnerException);
            foreach (PropertyInfo property in ex.GetType().GetProperties())
            {
                if (property.Name == "Message"
                    || property.Name == "Source"
                    || property.Name == "StackTrace"
                    || property.Name == "InnerException"
                    || property.Name == "Data")
                    continue;

                ReportProperty p = new ReportProperty(ex, property);
                rex.Properties.AddReportProperty(p);
            }

            /*
            if (ex.Data!=null)
            {
                foreach (DictionaryEntry de in ex.Data)
                {
                    ReportProperty p = new ReportProperty(de);
                    rex.Properties.Add(p);
                }
            }
            */

            return rex;
        }
Esempio n. 10
0
 public ReportSetUpAndTearDown(string name, ReportMonitor monitor, Exception ex)
     : this(name, monitor)
 {
     this.Result    = ReportRunResult.Failure;
     this.Exception = ReportException.FromException(ex);
 }
Esempio n. 11
0
		protected ReportExceptionException(SerializationInfo info, StreamingContext context)
            : base(info, context)
		{
			this.exception = (ReportException)info.GetValue("Exception",typeof(ReportException));
		}
Esempio n. 12
0
		public void AddException(ReportException ex)
		{
			this.exceptionTreeView.Nodes.Clear();

			// adding recursively the exceptions
			ReportException current = ex;
			TreeNode parent = null;
			while(current!=null)
			{
				TreeNode node =new TreeNode(current.Type);
				node.Tag = current;

				if (parent==null)
				{
					this.exceptionTreeView.Nodes.Add(node);
					this.exceptionTreeView.SelectedNode = node;
					parent = node;
				}
				else
				{
					parent.Nodes.Add(node);
					parent = node;
				}

				current = current.Exception;
			}

			this.exceptionTreeView.ExpandAll();
			this.RefreshException();
			this.Refresh();
		}
Esempio n. 13
0
		public virtual void VisitException(ReportException exception)
		{
			if (exception.Exception!=null)
				VisitException(exception.Exception);
		}