Ejemplo n.º 1
0
        public static string GetErrorMessage(Exception exception)
        {
            var fullMethodNames = new StackTraceWrapper(exception).GetFullMethodNames();

            var messages = fullMethodNames.FindAll(name => ErrorMap.ContainsKey(name)).Select(name => ErrorMap[name]).ToList();

            messages.Reverse();

            return String.Join(" -> ", messages);
        }
Ejemplo n.º 2
0
 public void ShouldBeAbleToGetFullNameOfMethodsFromStackTrace()
 {
     try
     {
         new TestClass().ThrowException();
     }
     catch (Exception ex)
     {
         var stackTraceWrapper = new StackTraceWrapper(ex);
         var fullMethodNames = stackTraceWrapper.GetFullMethodNames();
         Assert.That(fullMethodNames, Has.Member("UnitTests.TestErrorDiscription.Method1"));
     }
 }