Table of Contents

Class FakeLogCollectorTUnitInspectionExtensions

Namespace
LogAssertions.TUnit
Assembly
LogAssertions.TUnit.dll

TUnit-specific non-asserting inspection helpers on Microsoft.Extensions.Logging.Testing.FakeLogCollector. The framework-agnostic counterparts live in FakeLogCollectorInspectionExtensions in the LogAssertions core package; helpers here add bindings to TUnit's per-test output writer so the rendered records appear inline in the test report.

public static class FakeLogCollectorTUnitInspectionExtensions
Inheritance
FakeLogCollectorTUnitInspectionExtensions
Inherited Members

Methods

DumpToTestOutput(FakeLogCollector)

Renders every captured record to the current TUnit test's standard output writer using the same formatter the failure-message snapshot uses. Equivalent to collector.DumpTo(TestContext.Current.Output.StandardOutput), but skips the boilerplate. Use during test development to see what was actually logged before writing the assertion.

public static void DumpToTestOutput(this FakeLogCollector collector)

Parameters

collector FakeLogCollector

The collector to dump.

Exceptions

ArgumentNullException

collector is null.

InvalidOperationException

Called outside a TUnit test execution (no TUnit.Core.TestContext.Current). The method is only meaningful inside a [Test] method; the failure mode here is a clear diagnostic rather than a silent no-op.

DumpToTestOutput(FakeLogCollector, DumpVerbosity)

Verbosity-controlled overload of DumpToTestOutput(FakeLogCollector). The no-arg overload uses Default; pass an explicit verbosity to surface less (Compact: headlines only) or more (Verbose: full exception stack trace).

public static void DumpToTestOutput(this FakeLogCollector collector, DumpVerbosity verbosity)

Parameters

collector FakeLogCollector

The collector to dump.

verbosity DumpVerbosity

How much detail to render per record. See DumpVerbosity for the contract of each level.

Exceptions

ArgumentNullException

collector is null.

InvalidOperationException

There is no active TUnit test context.