public void DefaultCtor() { MultiLineText text = new MultiLineText(); Assert.AreEqual(0, text.Count); Assert.AreEqual("", text.ToString()); }
public void StringCtor_Implicit() { string line = Gettysburg[0]; MultiLineText text = line; Assert.AreEqual(1, text.Count); Assert.AreEqual(line, text.ToString()); Assert.AreEqual(line, text[0]); }
//--------------------------------------------------------------------- private void AssertLinesEqual(string[] lines, MultiLineText text) { Assert.AreEqual(lines.Length, text.Count); for (int i = 0; i < lines.Length; ++i) { Assert.AreEqual(lines[i], text[i]); } Assert.AreEqual(JoinLines(lines), text.ToString()); }
public void JustMessage_MultiLine() { string[] lines = new string[] { "Roses are red", "Violets are blue" }; MultiLineText message = new MultiLineText(lines); MultiLineException exception = new MultiLineException(message); Assert.IsNull(exception.InnerException); Assert.AreEqual(message.ToString(), exception.Message); Assert.AreEqual(lines.Length, exception.MultiLineMessage.Count); for (int i = 0; i < lines.Length; i++) { Assert.AreEqual(lines[i], exception.MultiLineMessage[i]); } }
public void JustMessage_MultiLine() { string[] lines = new string[]{ "Roses are red", "Violets are blue" }; MultiLineText message = new MultiLineText(lines); MultiLineException exception = new MultiLineException(message); Assert.IsNull(exception.InnerException); Assert.AreEqual(message.ToString(), exception.Message); Assert.AreEqual(lines.Length, exception.MultiLineMessage.Count); for (int i = 0; i < lines.Length; i++) Assert.AreEqual(lines[i], exception.MultiLineMessage[i]); }
//--------------------------------------------------------------------- private void SetMultiLineMessage(MultiLineText message, MultiLineText innerMessage) { if (message.Count == 1 && innerMessage != null) multiLineMessage = new MultiLineText(message.ToString() + ":"); else multiLineMessage = new MultiLineText(message); if (innerMessage != null) { foreach (string line in innerMessage) multiLineMessage.Add(Indent + line); } }
//--------------------------------------------------------------------- private static string ConvertToString(MultiLineText message) { if (message == null) throw new System.ArgumentNullException(); return message.ToString(); }
//--------------------------------------------------------------------- private void AssertLinesEqual(string[] lines, MultiLineText text) { Assert.AreEqual(lines.Length, text.Count); for (int i = 0; i < lines.Length; ++i) Assert.AreEqual(lines[i], text[i]); Assert.AreEqual(JoinLines(lines), text.ToString()); }
public void StringCtor() { string line = Gettysburg[0]; MultiLineText text = new MultiLineText(line); Assert.AreEqual(1, text.Count); Assert.AreEqual(line, text.ToString()); Assert.AreEqual(line, text[0]); }