Skip to content

Commit 0357fb0

Browse files
committed
Strengthen assertions on ArgumentNullException
It's a bit overkill but hey, gotta keep that 100% mutation score!
1 parent 2eb76fa commit 0357fb0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/Log4NetTextFormatterTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public void NullLogEventThrowsArgumentNullException()
7878
Action action = () => formatter.Format(null!, TextWriter.Null);
7979

8080
// Assert
81-
action.Should().ThrowExactly<ArgumentNullException>().Which.ParamName.Should().Be("logEvent");
81+
action.Should().ThrowExactly<ArgumentNullException>().WithParameterName("logEvent")
82+
.Which.StackTrace!.TrimStart().Should().StartWith("at Serilog.Formatting.Log4Net.Log4NetTextFormatter.Format");
8283
}
8384

8485
[Fact]
@@ -92,7 +93,8 @@ public void NullOutputThrowsArgumentNullException()
9293
Action action = () => formatter.Format(logEvent, null!);
9394

9495
// Assert
95-
action.Should().ThrowExactly<ArgumentNullException>().Which.ParamName.Should().Be("output");
96+
action.Should().ThrowExactly<ArgumentNullException>().WithParameterName("output")
97+
.Which.StackTrace!.TrimStart().Should().StartWith("at Serilog.Formatting.Log4Net.Log4NetTextFormatter.Format");
9698
}
9799

98100
[Fact]

0 commit comments

Comments
 (0)