Namespace LogAssertions.TUnit
Classes
- AssertAllExtensions
Batch-assertion entry point that runs multiple independent assertions against the same Microsoft.Extensions.Logging.Testing.FakeLogCollector in a single pass and reports all failures together, rather than failing fast on the first one. Conceptually similar to TUnit's own
Assert.Multiple, scoped specifically to log assertions.
- FakeLogCollectorTUnitInspectionExtensions
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.
- FakeLoggingBuilderExtensions
ILoggingBuilder extensions that wire a Microsoft.Extensions.Logging.Testing.FakeLogCollector into a logging builder you already own - a host's
ConfigureLogging, a Create(Action<ILoggingBuilder>) callback, or any other - so the capture composes alongside your own level, filters, and providers. Use these when the self-contained CreateTeed(LogLevel) tuple does not fit because the capture must live inside an existing builder, for example an ASP.NET Core test host.
- HasLoggedAssertion
TUnit assertion that verifies a Microsoft.Extensions.Logging.Testing.FakeLogCollector contains matching log records. Inherits filter chaining from LogAssertionBase<TSelf>; adds count-expectation terminators (
Once,Exactly,AtLeast,AtMost,Never) and the value-returning terminatorsGetMatchandGetMatchesfor handing the matched records to follow-up assertions.
- HasLoggedOnlyAssertion
TUnit assertion that gates a test run on its log output: every captured record at or above
floormust have been produced by one of the allowed definitions. Records below the floor are always permitted and are never enumerated, which is what makes the gate usable on a real service: the interesting band (warnings and errors) is small and can be listed, while the Debug/Trace volume (heartbeats, request bodies, request tracing) is not.
- HasLoggedSequenceAssertion
TUnit assertion that verifies a Microsoft.Extensions.Logging.Testing.FakeLogCollector contains a sequence of matching log records, in order. Each step is built from the same filter chain as HasLoggedAssertion (
AtLevel,Containing, etc.); call Then() to commit the current step and start the next strictly-ordered step, or ThenAnyOrder(params Action<HasLoggedSequenceAssertion>[]) to commit a concurrent group whose sub-steps must all occur but in any order.
- HasNotLoggedAssertion
TUnit assertion that verifies a Microsoft.Extensions.Logging.Testing.FakeLogCollector does not contain matching log records. Inherits filter chaining from LogAssertionBase<TSelf>; the expectation is fixed at zero matches (no terminators).
- LogAssertionBase<TSelf>
Shared base class for HasLoggedAssertion, HasNotLoggedAssertion, and HasLoggedSequenceAssertion. Implements the filter chain (level, message, exception, structured-state, scope, event, and arbitrary-predicate filters) and the failure-message snapshot rendering. Derived classes own count-expectation semantics and the
[AssertionExtension]attribute that registers the entry-point name.
- TestOutputLogCollectorBuilder
TUnit-specific counterpart to LogCollectorBuilder that, in addition to capturing records into a Microsoft.Extensions.Logging.Testing.FakeLogCollector for assertions, mirrors each record live to the active TUnit test's output writer. Use this when you want the test's logs to appear inline in the per-test report; use the core Create(LogLevel) (no tee) for log-heavy soak tests where buffering every record in the per-test output is undesirable.