public void ShouldFlattenTheException() { var formatException = new FormatException("FormatException Message"); var argumentNullException = new ArgumentNullException("ArgumentNullException Message", formatException); var exception = new Exception("Exception Message", argumentNullException); var exceptionFlatten = exception.Flatten(); const string messageExpected = "Exception Message\r\nArgumentNullException Message\r\nFormatException Message\r\n"; Assert.AreEqual(messageExpected, exceptionFlatten); }
public void ShouldFlattenException() { Exception e = new Exception("Step 1", new ArgumentException("Step 2", new NullReferenceException("Step 3", new InvalidOperationException("Step 4", new NotImplementedException("Step 5"))))); AggregateException exception = e.Flatten(); Assert.Equal(5, exception.InnerExceptions.Count); }
public DesignTimeException(Exception exception) : base(exception.Flatten(true), exception) { }
public void Error(Exception exception) { _debug.Error(exception); _file.WriteLine(exception.Flatten()); _file.WriteLine(exception.Source); _file.WriteLine(exception.StackTrace); }