Skip to content

Commit

Permalink
Fix report title
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarypiatek committed Nov 24, 2023
1 parent 541e90c commit af6f9b5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/NScenario/OutputWriters/MarkdownFormatterOutputWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace NScenario.OutputWriters
{
public class MarkdownFormatterOutputWriter: IScenarioOutputWriter
{
private readonly string? _title;
private readonly Func<string> _currentTestIdentifierAccessor;
private readonly ConcurrentDictionary<string, StringBuilder> _outputBuilders = new ConcurrentDictionary<string, StringBuilder>();

Expand All @@ -34,11 +35,8 @@ private StringBuilder OutputBuilder
/// <param name="currentTestIdentifierAccessor">Function that returns unique identifier representing currently executed scenario. Should be provided when tests are executed in parallel mode</param>
public MarkdownFormatterOutputWriter(string? title = null, Func<string>? currentTestIdentifierAccessor = null)
{
_title = title;
_currentTestIdentifierAccessor = currentTestIdentifierAccessor ?? (() => "SHARED_ID");
if (title != null)
{
OutputBuilder.AppendLine($"# {title}");
}
}

public void WriteStepDescription(string description)
Expand All @@ -63,6 +61,10 @@ public void WriteScenarioTitle(string scenarioTitle)
public string GetMarkdown()
{
var mergedMarkdown = new StringBuilder();
if (string.IsNullOrWhiteSpace(_title) == false)
{
mergedMarkdown.AppendLine($"# {_title}");
}
foreach (var builder in _outputBuilders.Values)
{
mergedMarkdown.Append(builder.ToString());
Expand Down

0 comments on commit af6f9b5

Please sign in to comment.