Skip to content

Commit 53a0316

Browse files
committed
Make Log4NetTextFormatterOptionsBuilder constructor internal
1 parent b1871ca commit 53a0316

4 files changed

+31
-153
lines changed

src/Log4NetTextFormatterOptionsBuilder.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ namespace Serilog.Formatting.Log4Net
1010
/// </summary>
1111
public class Log4NetTextFormatterOptionsBuilder
1212
{
13+
/// <summary>
14+
/// Initialize a new instance of the <see cref="Log4NetTextFormatterOptionsBuilder"/> class.
15+
/// </summary>
16+
internal Log4NetTextFormatterOptionsBuilder()
17+
{
18+
}
19+
1320
/// <summary>
1421
/// The <see cref="IFormatProvider"/> used when formatting message and properties of log4net events.
1522
/// <para>The default value is <see langref="null"/>, meaning that the default Serilog provider is used, i.e. the <see cref="CultureInfo.InvariantCulture"/>.</para>

tests/Log4NetTextFormatterOptionsBuilderTest.cs

Lines changed: 0 additions & 152 deletions
This file was deleted.

tests/Log4NetTextFormatterTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ public void NullOutputThrowsArgumentNullException()
8080
action.Should().ThrowExactly<ArgumentNullException>().Which.ParamName.Should().Be("output");
8181
}
8282

83+
[Fact]
84+
public void SettingPropertyFilterToNullThrowsArgumentNullException()
85+
{
86+
// Act
87+
Action action = () => _ = new Log4NetTextFormatter(c => c.UsePropertyFilter(null!));
88+
89+
// Assert
90+
action.Should().ThrowExactly<ArgumentNullException>()
91+
.WithMessage("The FilterProperty option can not be null.*")
92+
.And.ParamName.Should().Be("filterProperty");
93+
}
94+
95+
[Fact]
96+
public void SettingExceptionFormatterToNullThrowsArgumentNullException()
97+
{
98+
// Act
99+
Action action = () => _ = new Log4NetTextFormatter(c => c.UseExceptionFormatter(null!));
100+
101+
// Assert
102+
action.Should().ThrowExactly<ArgumentNullException>()
103+
.WithMessage("The FormatException option can not be null.*")
104+
.And.ParamName.Should().Be("formatException");
105+
}
106+
83107
[Theory]
84108
[InlineData(Events.LogEventLevel.Verbose)]
85109
[InlineData(Events.LogEventLevel.Debug)]

tests/PublicApi.Serilog.Formatting.Log4Net.approved.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ namespace Serilog.Formatting.Log4Net
3939
}
4040
public class Log4NetTextFormatterOptionsBuilder
4141
{
42-
public Log4NetTextFormatterOptionsBuilder() { }
4342
public Serilog.Formatting.Log4Net.CDataMode CDataMode { get; }
4443
public Serilog.Formatting.Log4Net.PropertyFilter FilterProperty { get; }
4544
public Serilog.Formatting.Log4Net.ExceptionFormatter FormatException { get; }

0 commit comments

Comments
 (0)