Table of Contents

Class SpanCaptureAssertions

Namespace
TracingAssertions.TUnit
Assembly
TracingAssertions.TUnit.dll

TUnit-native fluent assertions over a SpanCapture: capture-level checks that do not require the caller to first locate a span.

public static class SpanCaptureAssertions
Inheritance
SpanCaptureAssertions
Inherited Members

Remarks

Source methods carry the [GenerateAssertion] attribute; TUnit's source generator emits the fluent Assert.That(capture).<Method>() entry point at consumer build time.

Methods

HasNoSpan(SpanCapture, string)

Asserts that capture contains no span whose OperationName equals operationName (ordinal): the inverse of HasSpan(SpanCapture, string), for verifying an operation was never traced.

[GenerateAssertion]
public static AssertionResult HasNoSpan(this SpanCapture capture, string operationName)

Parameters

capture SpanCapture

The span capture, as the receiver of the fluent assertion.

operationName string

The operation name expected to be absent.

Returns

AssertionResult

A passing assertion when no matching span was captured; otherwise a failing assertion.

Exceptions

ArgumentNullException

capture or operationName is null.

HasSpan(SpanCapture, string)

Asserts that capture contains at least one span whose OperationName equals operationName (ordinal).

[GenerateAssertion]
public static AssertionResult HasSpan(this SpanCapture capture, string operationName)

Parameters

capture SpanCapture

The span capture, as the receiver of the fluent assertion.

operationName string

The operation name expected to appear among the captured spans.

Returns

AssertionResult

A passing assertion when a matching span was captured; otherwise a failing assertion listing the captured operation names.

Exceptions

ArgumentNullException

capture or operationName is null.

HasSpanCount(SpanCapture, int)

Asserts that capture captured exactly expected spans.

[GenerateAssertion]
public static AssertionResult HasSpanCount(this SpanCapture capture, int expected)

Parameters

capture SpanCapture

The span capture, as the receiver of the fluent assertion.

expected int

The expected number of captured spans. Must be non-negative.

Returns

AssertionResult

A passing assertion when the captured count matches; otherwise a failing assertion naming the expected and observed counts.

Exceptions

ArgumentNullException

capture is null.

ArgumentOutOfRangeException

expected is negative.