Skip to content

Commit d6ae268

Browse files
committed
Restore 100% coverage
The coverlet 10.0.1 upgrade spotted a branch that was not 100% covered.
1 parent cfcd0c9 commit d6ae268

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<log4net:event timestamp="2003-01-04T15:09:26.535+01:00" level="INFO" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2/">
2+
<log4net:message><![CDATA[Hello from Serilog]]></log4net:message>
3+
</log4net:event>

tests/Log4NetTextFormatterTest.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,22 @@ public Task Caller()
684684
return Verify(output);
685685
}
686686

687+
[Fact]
688+
public Task CallerWithFile()
689+
{
690+
// Arrange
691+
using var output = new StringWriter();
692+
var logEvent = CreateLogEvent(properties: new LogEventProperty("Caller", new ScalarValue("Fully.Qualified.ClassName.MethodName(System.String) /Absolute/Path/To/FileName.cs:123")));
693+
694+
var formatter = new Log4NetTextFormatter();
695+
696+
// Act
697+
formatter.Format(logEvent, output);
698+
699+
// Assert
700+
return Verify(output);
701+
}
702+
687703
[Fact]
688704
public Task CallerNonScalar()
689705
{
@@ -701,11 +717,11 @@ public Task CallerNonScalar()
701717
}
702718

703719
[Fact]
704-
public Task CallerWithFile()
720+
public Task CallerInvalidFormat()
705721
{
706722
// Arrange
707723
using var output = new StringWriter();
708-
var logEvent = CreateLogEvent(properties: new LogEventProperty("Caller", new ScalarValue("Fully.Qualified.ClassName.MethodName(System.String) /Absolute/Path/To/FileName.cs:123")));
724+
var logEvent = CreateLogEvent(properties: new LogEventProperty("Caller", new ScalarValue("NotFullyQualifiedMethodName")));
709725

710726
var formatter = new Log4NetTextFormatter();
711727

0 commit comments

Comments
 (0)