Skip to content

Commit

Permalink
Added test for timestamp formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
epeshk authored and nblumhardt committed Aug 20, 2024
1 parent 64fccfa commit 9f6b814
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ public void LowercaseFormatSpecifierIsSupportedForStrings()
Assert.Equal("nick", sw.ToString());
}

[Theory]
[InlineData(16)]
[InlineData(100)]
public void RendersTimestampFormatsOfDifferentLengths(int length)
{
var longFormatString = new string('-', length);
var formatter = new MessageTemplateTextFormatter($"{{Timestamp:{longFormatString}}}", CultureInfo.InvariantCulture);
var evt = DelegatingSink.GetLogEvent(l => l.Information("{Name}", "Nick"));
var sw = new StringWriter();
formatter.Format(evt, sw);
Assert.Contains(longFormatString, sw.ToString());
}

[Theory]
[InlineData(Verbose, 1, "V")]
[InlineData(Verbose, 2, "Vb")]
Expand Down

0 comments on commit 9f6b814

Please sign in to comment.