Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public readonly partial struct ProcessOutputLine
public ProcessOutputLine(string content, bool standardError) { throw null; }
public string Content { get { throw null; } }
public bool StandardError { get { throw null; } }
public override string ToString() { throw null; }
Comment thread
adamsitnik marked this conversation as resolved.
}
public enum ProcessPriorityClass
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ public ProcessOutputLine(string content, bool standardError)
/// otherwise, <see langword="false" />.
/// </value>
public bool StandardError { get; }

/// <summary>
/// Returns the text content of the output line, or <see cref="string.Empty"/> if the struct was default-initialized.
/// </summary>
/// <returns>The value of <see cref="Content"/>, or <see cref="string.Empty"/> if <see cref="Content"/> is <see langword="null"/>.</returns>
public override string ToString() => Content ?? string.Empty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -694,5 +694,25 @@ private Process StartLinePrintingProcess(string stdOutText, string stdErrText)

return (capturedOutput, capturedError);
}

[Theory]
[InlineData("hello")]
[InlineData("")]
[InlineData("line with spaces")]
public void ProcessOutputLine_ToString_ReturnsContent(string content)
{
ProcessOutputLine line = new(content, standardError: false);
Assert.Equal(content, line.ToString());

ProcessOutputLine errorLine = new(content, standardError: true);
Assert.Equal(content, errorLine.ToString());
}

[Fact]
public void ProcessOutputLine_Default_ToString_ReturnsEmpty()
{
ProcessOutputLine line = default;
Assert.Equal(string.Empty, line.ToString());
}
}
}
Loading