public void Exception2Test() { var root = new ApplicationException("exception1", new ApplicationException("exception2")); var flattened = root.FlattenToString(); Assert.IsTrue(string.Equals(flattened, $"exception1{Environment.NewLine}exception2", StringComparison.Ordinal), "Flattened not as expected"); }
public void ExceptionTest() { var innerExceptions = new Exception[] { new ApplicationException("exception3"), new ApplicationException("exception4") }; var innerException = new AggregateException("exception2", innerExceptions); var root = new ApplicationException("exception1", innerException); var flattened = root.FlattenToString(); Assert.IsTrue(string.Equals(flattened, $"exception1{Environment.NewLine}exception2 (exception3) (exception4){Environment.NewLine}{Environment.NewLine}exception3{Environment.NewLine}exception4", StringComparison.Ordinal), "Flattened not as expected"); }