public string markAsException(string fragment, string expression, string errorMessage) { var exception = new StackTraceSettingException(errorMessage); exception.StackTraceElements.AddRange(stackTraceElements); var document = new TestRig() .ProcessFragment(fragment) .GetXDocument(); var element = new Element(document.Descendants("p").ToArray()[0]); new ExceptionRenderer().ExceptionCaught(new ExceptionCaughtEvent(exception, element, expression)); return(element.ToXml()); }
public string markAsException(string fragment, string expression, string errorMessage) { var exception = new StackTraceSettingException(errorMessage); exception.StackTraceElements.AddRange(stackTraceElements); var document = new TestRig() .ProcessFragment(fragment) .GetXDocument(); var element = document.Descendants("p").ToArray()[0]; var eventArgs = new ExceptionCaughtEventArgs { Exception = exception, Expression = expression, Element = new Element(element) }; new ExceptionRenderer().ExceptionCaughtEventHandler(this, eventArgs); //return element.ToString(SaveOptions.DisableFormatting); return(element.ToString()); }