Skip to content

Use Constructor / Dispose instead of [Before(Test)] / [After(Test)] #801

Use Constructor / Dispose instead of [Before(Test)] / [After(Test)]

Use Constructor / Dispose instead of [Before(Test)] / [After(Test)] #801

GitHub Actions / 🚦 Test Results (Linux) failed May 4, 2025 in 1s

77 passed, 3 failed and 0 skipped

Tests failed

❌ Serilog.Formatting.Log4Net.Tests.trx

80 tests were completed in 681ms with 77 passed, 3 failed and 0 skipped.

Test suite Passed Failed Skipped Time
Serilog.Formatting.Log4Net.Tests.IndentationSettingsTest 6✅ 168ms
Serilog.Formatting.Log4Net.Tests.LineEndingTest 1✅ 98ms
Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest 67✅ 3❌ 633ms
Serilog.Formatting.Log4Net.Tests.PublicApi 3✅ 836ms

✅ Serilog.Formatting.Log4Net.Tests.IndentationSettingsTest

✅ IndentationSettingsToString(Space, 2,   )
✅ IndentationSettingsToString(Space, 4,     )
✅ IndentationSettingsToString(Tab, 2, 		)
✅ IndentationSettingsToString(Tab, 4, 				)
✅ InvalidIndentation
✅ InvalidSize

✅ Serilog.Formatting.Log4Net.Tests.LineEndingTest

✅ InvalidLineEnding

❌ Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest

✅ Caller
✅ CallerLog4J
✅ CallerNonScalar
✅ CallerWithFile
✅ CustomLogEventPropertyValue
✅ CustomMessageFormatter
✅ DefaultFormatProvider
✅ DefaultMessageFormatter(0, EventName)
✅ DefaultMessageFormatter(0, null)
✅ DefaultMessageFormatter(1, EventName)
✅ DefaultMessageFormatter(1, null)
✅ DictionaryProperty
✅ DomainAndUserNameProperty()
✅ DomainAndUserNameProperty(null)
✅ DomainAndUserNameProperty(TheDomain\TheUser)
✅ DomainAndUserNameProperty(TheDomain\TheUser\Name)
✅ DomainAndUserNameProperty(TheUser)
✅ DomainAndUserNamePropertyStructureValue
✅ Exception
✅ ExceptionFormatter
✅ ExceptionFormatterReturningNull
❌ ExceptionFormatterThrowing
	AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting an exception.".
✅ ExplicitFormatProvider
✅ FilterProperty
❌ FilterPropertyThrowing
	AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while filtering property 'two'.".
✅ IndentationSettings(Space, 2)
✅ IndentationSettings(Space, 4)
✅ IndentationSettings(Tab, 2)
✅ IndentationSettings(Tab, 4)
✅ InvalidLogEventLevelThrowsArgumentOutOfRangeException
✅ Log4JCompatibility(False)
✅ Log4JCompatibility(True)
✅ LogEventLevel(Debug)
✅ LogEventLevel(Error)
✅ LogEventLevel(Fatal)
✅ LogEventLevel(Information)
✅ LogEventLevel(Verbose)
✅ LogEventLevel(Warning)
✅ LoggerName
✅ LoggerNameStructureValue
✅ MachineNameProperty(null)
✅ MachineNameProperty(TheMachineName)
✅ MachineNamePropertyStructureValue
✅ MessageCDataMode(Always, False)
✅ MessageCDataMode(Always, True)
✅ MessageCDataMode(IfNeeded, False)
✅ MessageCDataMode(IfNeeded, True)
✅ MessageCDataMode(Never, False)
✅ MessageCDataMode(Never, True)
✅ MessageFormatterReturningNull
❌ MessageFormatterThrowing
	AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting a message.".
✅ NoIndentation
✅ NoNamespace
✅ NullLogEventThrowsArgumentNullException
✅ NullOutputThrowsArgumentNullException
✅ NullProperty
✅ SequenceProperty
✅ SettingExceptionFormatterToNullThrowsArgumentNullException
✅ SettingMessageFormatterToNullThrowsArgumentNullException
✅ SettingPropertyFilterToNullThrowsArgumentNullException
✅ StructureProperty
✅ ThreadIdProperty(1)
✅ ThreadIdProperty(null)
✅ TwoEvents
✅ TwoProperties
✅ TwoPropertiesOneNull
✅ XmlElementsLineEnding(CarriageReturn)
✅ XmlElementsLineEnding(LineFeed, CarriageReturn)
✅ XmlElementsLineEnding(LineFeed)
✅ XmlElementsLineEnding(None)

✅ Serilog.Formatting.Log4Net.Tests.PublicApi

✅ ApprovePublicApi(net6.0)
✅ ApprovePublicApi(net8.0)
✅ ApprovePublicApi(netstandard2.0)

Annotations

Check failure on line 577 in tests/Log4NetTextFormatterTest.cs

See this annotation in the file changed.

@github-actions github-actions / 🚦 Test Results (Linux)

Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest ► ExceptionFormatterThrowing

Failed test found in:
  Serilog.Formatting.Log4Net.Tests.trx
Error:
  AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting an exception.".
Raw output
AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting an exception.".
   at FluentAssertions.Execution.FallbackTestFramework.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.AddPreFormattedFailure(String formattedFailureMessage)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(String message, Object[] args)
   at FluentAssertions.Primitives.StringAssertions`1.Contain(String expected, String because, Object[] becauseArgs)
   at Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest.ExceptionFormatterThrowing() in /home/runner/work/serilog-formatting-log4net/serilog-formatting-log4net/tests/Log4NetTextFormatterTest.cs:line 577

Check failure on line 417 in tests/Log4NetTextFormatterTest.cs

See this annotation in the file changed.

@github-actions github-actions / 🚦 Test Results (Linux)

Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest ► FilterPropertyThrowing

Failed test found in:
  Serilog.Formatting.Log4Net.Tests.trx
Error:
  AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while filtering property 'two'.".
Raw output
AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while filtering property 'two'.".
   at FluentAssertions.Execution.FallbackTestFramework.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.AddPreFormattedFailure(String formattedFailureMessage)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(String message, Object[] args)
   at FluentAssertions.Primitives.StringAssertions`1.Contain(String expected, String because, Object[] becauseArgs)
   at Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest.FilterPropertyThrowing() in /home/runner/work/serilog-formatting-log4net/serilog-formatting-log4net/tests/Log4NetTextFormatterTest.cs:line 417

Check failure on line 531 in tests/Log4NetTextFormatterTest.cs

See this annotation in the file changed.

@github-actions github-actions / 🚦 Test Results (Linux)

Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest ► MessageFormatterThrowing

Failed test found in:
  Serilog.Formatting.Log4Net.Tests.trx
Error:
  AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting a message.".
Raw output
AssertionFailedException: Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting a message.".
   at FluentAssertions.Execution.FallbackTestFramework.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.AddPreFormattedFailure(String formattedFailureMessage)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(Func`1 getFailureReason)
   at FluentAssertions.Execution.AssertionChain.FailWith(String message, Object[] args)
   at FluentAssertions.Primitives.StringAssertions`1.Contain(String expected, String because, Object[] becauseArgs)
   at Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest.MessageFormatterThrowing() in /home/runner/work/serilog-formatting-log4net/serilog-formatting-log4net/tests/Log4NetTextFormatterTest.cs:line 531