public void Message_should_consolidate_competing_inner_line_infos() { // No need to display two line infos in ToString() or Message var inner = new PropertyTreeException("error", 10, 20); var e = new PropertyTreeException("outer", inner, 2, 4); Assert.That(e.ToString(), Is.StringMatching("line 10, pos 20")); Assert.That(e.Message, Is.Not.StringMatching("line 2, pos4")); }
static string BuildMessage(string message, FileLocation location, PropertyTreeException inner) { // Don't present multiple line infos if (location.IsEmpty || (inner != null && inner.LineNumber > 0)) { return(message); } else { return(message + Environment.NewLine + Environment.NewLine + location.ToString("h")); } }
static string BuildMessage(string message, FileLocation location, PropertyTreeException inner) { // Don't present multiple line infos if (location.IsEmpty || (inner != null && inner.LineNumber > 0)) return message; else return message + Environment.NewLine + Environment.NewLine + location.ToString("h"); }