Skip to content

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

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

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

GitHub Actions / 🚦 Test Results (Linux) failed Jan 16, 2025 in 0s

70 passed, 2 failed and 0 skipped

Tests failed

❌ Serilog.Formatting.Log4Net.Tests.trx

72 tests were completed in 761ms with 70 passed, 2 failed and 0 skipped.

Test suite Passed Failed Skipped Time
Serilog.Formatting.Log4Net.Tests.IndentationSettingsTest 6✅ 340ms
Serilog.Formatting.Log4Net.Tests.LineEndingTest 1✅ 43ms
Serilog.Formatting.Log4Net.Tests.Log4NetTextFormatterTest 60✅ 2❌ 3s
Serilog.Formatting.Log4Net.Tests.PublicApi 3✅ 617ms

✅ 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
✅ DefaultFormatProvider
✅ DictionaryProperty
✅ DomainAndUserNameProperty()
✅ DomainAndUserNameProperty(null)
✅ DomainAndUserNameProperty(TheDomain\TheUser)
✅ DomainAndUserNameProperty(TheDomain\TheUser\Name)
✅ DomainAndUserNameProperty(TheUser)
✅ DomainAndUserNamePropertyStructureValue
✅ Exception
✅ ExceptionFormatter
✅ ExceptionFormatterReturningNull
❌ ExceptionFormatterThrowing
	Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting an exception.".
✅ ExplicitFormatProvider
✅ FilterProperty
❌ FilterPropertyThrowing
	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)
✅ NoIndentation
✅ NoNamespace
✅ NullLogEventThrowsArgumentNullException
✅ NullOutputThrowsArgumentNullException
✅ NullProperty
✅ SequenceProperty
✅ SettingExceptionFormatterToNullThrowsArgumentNullException
✅ 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 482 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:
  Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while formatting an exception.".
Raw output
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.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.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 482
   at TUnit.SourceGenerated.<Log4NetTextFormatterTest_46cc453d930249b18f25620f8e5b169e_Generated>F0107F1BB2BFE711009AAD952E6EB5889322A6CC62B199B914CE84C4D1AC67899__Log4NetTextFormatterTest.<>c__DisplayClass2_1.<Tests0>b__3() in /home/runner/work/serilog-formatting-log4net/serilog-formatting-log4net/tests/obj/Release/net8.0/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.CodeGenerators.TestsGenerator/Log4NetTextFormatterTest-46cc453d930249b18f25620f8e5b169e.Generated.cs:line 52
   at TUnit.Core.AsyncConvert.Convert(Func`1 action)
   at TUnit.Core.DiscoveredTest`1.ExecuteTest(CancellationToken cancellationToken)
   at TUnit.Engine.Helpers.Timings.Record(String name, TestContext context, Func`1 action)
   at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestMethodWithTimeout(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithCancellationTokens(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)

Check failure on line 405 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:
  Expected SelfLogValue "" to contain "[Serilog.Formatting.Log4Net.Log4NetTextFormatter] An exception was thrown while filtering property 'two'.".
Raw output
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.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.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 405
   at TUnit.SourceGenerated.<Log4NetTextFormatterTest_aad71dd201e44a2daf02351385a9f23b_Generated>F781B57876C7C9741D61C37C4DEF6BB92F8AE66CA942D0B00FD905C920321080C__Log4NetTextFormatterTest.<>c__DisplayClass2_1.<Tests0>b__3() in /home/runner/work/serilog-formatting-log4net/serilog-formatting-log4net/tests/obj/Release/net8.0/TUnit.Core.SourceGenerator/TUnit.Core.SourceGenerator.CodeGenerators.TestsGenerator/Log4NetTextFormatterTest-aad71dd201e44a2daf02351385a9f23b.Generated.cs:line 52
   at TUnit.Core.AsyncConvert.Convert(Func`1 action)
   at TUnit.Core.DiscoveredTest`1.ExecuteTest(CancellationToken cancellationToken)
   at TUnit.Engine.Helpers.Timings.Record(String name, TestContext context, Func`1 action)
   at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestMethodWithTimeout(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithCancellationTokens(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
   at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)