Class HasJsonTypeInfoForAssertion<T>
- Namespace
- JsonAssertions.TUnit
- Assembly
- JsonAssertions.TUnit.dll
The assertion produced by HasJsonTypeInfoFor<T>(IJsonContextAssertionSource). Holds the type whose registration is checked as a method-level generic and resolves to passed when GetTypeInfo(Type) returns a non-null JsonTypeInfo<T>.
public sealed class HasJsonTypeInfoForAssertion<T> : Assertion<JsonSerializerContext>, IAssertion
Type Parameters
TThe type whose registration is asserted.
- Inheritance
-
Assertion<JsonSerializerContext>HasJsonTypeInfoForAssertion<T>
- Implements
-
IAssertion
- Inherited Members
-
Assertion<JsonSerializerContext>.AssertAsync()Assertion<JsonSerializerContext>.GetAwaiter()Assertion<JsonSerializerContext>.AndAssertion<JsonSerializerContext>.Or
- Extension Methods
Constructors
HasJsonTypeInfoForAssertion(AssertionContext<JsonSerializerContext>)
Creates a new assertion bound to the supplied context.
public HasJsonTypeInfoForAssertion(AssertionContext<JsonSerializerContext> context)
Parameters
contextAssertionContext<JsonSerializerContext>The TUnit assertion context typed at JsonSerializerContext.
Methods
CheckAsync(EvaluationMetadata<JsonSerializerContext>)
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<JsonSerializerContext> metadata)
Parameters
metadataEvaluationMetadata<JsonSerializerContext>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()