/// <summary> /// Formats the document to a string by concatenating all formatted streams and /// displaying a "*** Stream Name ***" header for each stream name. /// </summary> /// <returns>The formatted text.</returns> public override string ToString() { StringBuilder builder = new StringBuilder(); for (int i = 0; i < streams.Count; i++) { if (i != 0) { builder.Append('\n'); } StructuredStream stream = streams[i]; builder.Append("*** ").Append(stream.Name).Append(" ***").Append("\n\n"); string contents = stream.ToString(); builder.Append(contents); if (!contents.EndsWith("\n")) { builder.Append('\n'); } } return(builder.ToString()); }
public void WriteToReproducesTheBodyOfTheStream() { StructuredStream stream = new StructuredStream("name") { Body = new BodyTag() { Contents = { new TextTag("text") } } }; StructuredTextWriter writer = new StructuredTextWriter(); stream.WriteTo(writer); writer.Close(); Assert.AreEqual(stream.ToString(), writer.ToString()); }
public void ToStringPrintsTheBody() { StructuredStream stream = new StructuredStream("name") { Body = new BodyTag() { Contents = { new TextTag("text") } } }; Assert.AreEqual("text", stream.ToString()); }
public static void AreEqual(StructuredStream expected, StructuredStream actual) { if (expected == null) { Assert.IsNull(actual); return; } Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.ToString(), actual.ToString()); // FIXME: not precise }
private void OutputLogStreamContents(StructuredStream stream) { string contents = string.Concat("*** ", stream.Name, " ***\n", stream.ToString(), "\n"); // ReSharper formats the TaskExplain contents only when the task result is of a particular value. // It will render it in a colored box based on the result code. // Unfortunately it can't really capture the richness of Gallio outcomes right now. switch (stream.Name) { case MarkupStreamNames.ConsoleError: Output(FacadeTaskOutputType.StandardError, contents); break; case MarkupStreamNames.DebugTrace: Output(FacadeTaskOutputType.DebugTrace, contents); break; case MarkupStreamNames.Warnings: pendingWarnings = contents; break; case MarkupStreamNames.Failures: pendingFailures = contents; break; default: Output(FacadeTaskOutputType.StandardOutput, contents); break; } }