Table of Contents

Class GrpcDoesNotThrowAssertion<TValue>

Namespace
GrpcAssertions.TUnit
Assembly
GrpcAssertions.TUnit.dll

Fluent TUnit assertion that a delegate completes without throwing a gRPC RpcException: the shape of the "benign error is swallowed" tests. Constructed by the DoesNotThrowGrpcException() entry point on a delegate assertion source.

public sealed class GrpcDoesNotThrowAssertion<TValue> : Assertion<TValue>, IAssertion

Type Parameters

TValue

The evaluated value type of the delegate under assertion.

Inheritance
Assertion<TValue>
GrpcDoesNotThrowAssertion<TValue>
Implements
IAssertion
Inherited Members
Assertion<TValue>.AssertAsync()
Assertion<TValue>.GetAwaiter()
Assertion<TValue>.And
Assertion<TValue>.Or

Remarks

The assertion runs over the raw delegate evaluation, so the thrown exception (if any) is in the metadata exception field. A thrown RpcException fails with the full gRPC outcome rendered; any other thrown exception fails naming its type and message (the call faulted, which the swallow tests do not expect); no exception passes.

Constructors

GrpcDoesNotThrowAssertion(AssertionContext<TValue>)

Initializes the assertion. Called by the DoesNotThrowGrpcException() entry point.

public GrpcDoesNotThrowAssertion(AssertionContext<TValue> context)

Parameters

context AssertionContext<TValue>

The assertion context supplied by TUnit.

Methods

CheckAsync(EvaluationMetadata<TValue>)

Implements the specific check logic for this assertion. Called after the context has been evaluated. Override this method if your assertion uses the default AssertAsync() flow. If you override AssertAsync() with custom logic (like AndAssertion/OrAssertion), you don't need to implement this.

protected override Task<AssertionResult> CheckAsync(EvaluationMetadata<TValue> metadata)

Parameters

metadata EvaluationMetadata<TValue>

Metadata about the evaluation including value, exception, and timing information

Returns

Task<AssertionResult>

The result of the assertion check

GetExpectation()

Gets a human-readable description of what this assertion expects. Used in error messages.

protected override string GetExpectation()

Returns

string