public static TaskException[] ConvertExceptions(ExceptionResult exception, out string message)
        {
            ExceptionResult current;
            if ((exception.FullTypeName == typeof(TargetInvocationException).FullName) && (exception.InnerExceptionResult != null))
            {
                current = exception.InnerExceptionResult;
            }
            else
            {
                current = exception;
            }

            message = null;
            var exceptions = new List<TaskException>();
            while (current != null)
            {
                if (message == null)
                {
                    message = string.Format("{0}: {1}", current.FullTypeName, current.Message);
                }

                exceptions.Add(new TaskException(current.FullTypeName, current.Message, current.StackTrace));
                current = current.InnerExceptionResult;
            }

            return exceptions.ToArray();
        }
コード例 #2
0
 public ExceptionResult(Exception exception)
     : this(exception.GetType().FullName, exception.GetType().Name, exception.Message, exception.StackTrace, null)
 {
     if (exception.InnerException != null)
     {
         InnerExceptionResult = new ExceptionResult(exception.InnerException);
     }
 }
コード例 #3
0
 public ExceptionResult(string fullTypeName, string typeName, string message, string stackTrace, ExceptionResult innerExceptionResult)
 {
     this.FullTypeName = fullTypeName;
     this.TypeName = typeName;
     this.Message = message;
     this.StackTrace = stackTrace;
     this.InnerExceptionResult = innerExceptionResult;
 }
コード例 #4
0
 public ExceptionResult(Exception exception)
     : this(exception.GetType().FullName, exception.GetType().Name, exception.Message, exception.StackTrace, null)
 {
     if (exception.InnerException != null)
     {
         InnerExceptionResult = new ExceptionResult(exception.InnerException);
     }
 }
コード例 #5
0
 public ExceptionResult(string fullTypeName, string typeName, string message, string stackTrace, ExceptionResult innerExceptionResult)
 {
     this.FullTypeName         = fullTypeName;
     this.TypeName             = typeName;
     this.Message              = message;
     this.StackTrace           = stackTrace;
     this.InnerExceptionResult = innerExceptionResult;
 }
コード例 #6
0
 public ExceptionResult(string fullTypeName, string typeName, string message, string stackTrace, ExceptionResult innerExceptionResult)
 {
     FullTypeName         = fullTypeName;
     TypeName             = typeName;
     Message              = message;
     StackTrace           = stackTrace;
     InnerExceptionResult = innerExceptionResult;
 }
コード例 #7
0
        public IMessage SyncProcessMessage(IMessage msg)
        {
            var methodCall = msg as IMethodCallMessage;

            if (methodCall != null)
            {
                return(RemotingServices.ExecuteMessage(this, methodCall));
            }

            // This is all a bit ugly but gives us version independance for the moment
            string value    = msg.Properties["data"] as string;
            var    doc      = XDocument.Load(new StringReader(value));
            var    element  = doc.XPathSelectElement("/listener/*");
            var    listener = (ISpecificationRunListener)this;

            switch (element.Name.ToString())
            {
            case "onassemblystart":
                listener.OnAssemblyStart(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblystart/*").ToString()));
                break;

            case "onassemblyend":
                listener.OnAssemblyEnd(AssemblyInfo.Parse(element.XPathSelectElement("//onassemblyend/*").ToString()));
                break;

            case "onrunstart":
                listener.OnRunStart();
                break;

            case "onrunend":
                listener.OnRunEnd();
                break;

            case "oncontextstart":
                listener.OnContextStart(ContextInfo.Parse(element.XPathSelectElement("//oncontextstart/*").ToString()));
                break;

            case "oncontextend":
                listener.OnContextEnd(ContextInfo.Parse(element.XPathSelectElement("//oncontextend/*").ToString()));
                break;

            case "onspecificationstart":
                listener.OnSpecificationStart(SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationstart/*").ToString()));
                break;

            case "onspecificationend":
                listener.OnSpecificationEnd(
                    SpecificationInfo.Parse(element.XPathSelectElement("//onspecificationend/specificationinfo").ToString()),
                    Result.Parse(element.XPathSelectElement("//onspecificationend/result").ToString()));
                break;

            case "onfatalerror":
                listener.OnFatalError(ExceptionResult.Parse(element.XPathSelectElement("//onfatalerror/*").ToString()));
                break;
            }

            return(null);
        }
コード例 #8
0
        public static void Run(this ISpecificationRunListener adapter, AssemblyInfo assemblyInfo,
                               SpecificationInfo specificationInfo, Result failure, ExceptionResult exceptionResult,
                               ContextInfo contexInfo)
        {
            adapter.OnAssemblyStart(assemblyInfo);
            adapter.OnAssemblyEnd(assemblyInfo);

            adapter.OnSpecificationStart(specificationInfo);
            adapter.OnSpecificationEnd(specificationInfo, failure);

            adapter.OnFatalError(exceptionResult);

            adapter.OnContextStart(contexInfo);
            adapter.OnContextEnd(contexInfo);

            adapter.OnRunStart();
            adapter.OnRunEnd();
        }
コード例 #9
0
        public static Result Parse(string resultXml)
        {
            var document        = XDocument.Parse(resultXml);
            var status          = document.SafeGet <Status>("/result/status");
            var result          = new Result(status);
            var exceptionresult = document.XPathSelectElement("/result/exception/exceptionresult");

            if (exceptionresult != null)
            {
                result.Exception = ExceptionResult.Parse(exceptionresult.ToString());
            }

            foreach (XElement supplement in document.XPathSelectElements("/result/supplements/supplement"))
            {
                string key = supplement.Attribute("key").Value;
                Dictionary <string, string> supplements = supplement.Elements("entry").ToDictionary(x => x.Attribute("key").Value, x => x.Value);
                result.Supplements.Add(key, supplements);
            }

            return(result);
        }
        public static void Run(this ISpecificationRunListener adapter, AssemblyInfo assemblyInfo, SpecificationInfo specificationInfo, Result failure, ExceptionResult exceptionResult, ContextInfo contexInfo)
        {
            adapter.OnAssemblyStart(assemblyInfo);
            adapter.OnAssemblyEnd(assemblyInfo);

            adapter.OnSpecificationStart(specificationInfo);
            adapter.OnSpecificationEnd(specificationInfo, failure);

            adapter.OnFatalError(exceptionResult);

            adapter.OnContextStart(contexInfo);
            adapter.OnContextEnd(contexInfo);

            adapter.OnRunStart();
            adapter.OnRunEnd(); 
        }
コード例 #11
0
 public static Result Failure(ExceptionResult exception)
 {
     return(new Result(exception));
 }
 public virtual void OnFatalError(ExceptionResult exceptionResult)
 {
     _runListener.OnFatalError(exceptionResult);
 }
コード例 #13
0
 public void OnFatalError(ExceptionResult exception)
 {
 }
コード例 #14
0
 public void OnFatalError(ExceptionResult exceptionResult)
 {
     fatalError = exceptionResult;
 }
 public void OnFatalError(ExceptionResult exception)
 {
     _reporter.OnFatalError(exception);
     _onFinished.Invoke(this);
 }
コード例 #16
0
 public void OnFatalError(ExceptionResult exception)
 {
     LastFatalError = exception;
 }
 public void OnFatalError(ExceptionResult exception)
 {
     LastFatalError = exception;
 }
コード例 #18
0
 public virtual void OnFatalError(ExceptionResult exceptionResult)
 {
     _runListener.OnFatalError(exceptionResult);
 }
 public void OnFatalError(ExceptionResult exceptionResult)
 {
     fatalError = exceptionResult;
 }
コード例 #20
0
 public void OnFatalError(ExceptionResult exceptionResult)
 {
     listeners.Each(listener => listener.OnFatalError(exceptionResult));
 }
コード例 #21
0
 private Result(Exception exception)
 {
     Status    = Status.Failing;
     Exception = new ExceptionResult(exception);
 }
コード例 #22
0
 private Result(ExceptionResult exception)
 {
     _status        = Status.Failing;
     this.Exception = exception;
 }
コード例 #23
0
 private Result(ExceptionResult exception)
 {
     Status    = Status.Failing;
     Exception = exception;
 }
 public void OnFatalError(ExceptionResult exceptionResult)
 {
     this.listeners.Each(listener => listener.OnFatalError(exceptionResult));
 }
 public void OnFatalError(ExceptionResult exception)
 {
 }