Class RouteContextSendExtensions
One-line sends for tests: replaces the GetEndpoint / CreateProducer / Start / Process
plumbing with , and ,
plus to reach the mock standing in for an endpoint.
Each call uses a short-lived , so producers are started and stopped
around the send and nothing leaks between tests.
public static class RouteContextSendExtensions
Inheritance
Methods
Mock(IRouteContext, string)
The standing in for uri: either a mock://name
public static MockEndpoint Mock(this IRouteContext context, string uri)
RequestBody<T>(IRouteContext, string, object?, CancellationToken)
Request-reply: sends body and returns the reply body converted to T.
public static Task<T?> RequestBody<T>(this IRouteContext context, string endpointUri, object? body, CancellationToken ct = default)
RequestBodyAndHeaders<T>(IRouteContext, string, object?, IEnumerable<KeyValuePair<string, object?>>, CancellationToken)
Request-reply with headers; returns the reply body converted to T.
public static Task<T?> RequestBodyAndHeaders<T>(this IRouteContext context, string endpointUri, object? body, IEnumerable<KeyValuePair<string, object?>> headers, CancellationToken ct = default)
SendBody(IRouteContext, string, object?, CancellationToken)
Sends body to endpointUri (in-only).
public static Task SendBody(this IRouteContext context, string endpointUri, object? body, CancellationToken ct = default)
SendBodyAndHeader(IRouteContext, string, object?, string, object?, CancellationToken)
Sends body with a single header to endpointUri (in-only).
public static Task SendBodyAndHeader(this IRouteContext context, string endpointUri, object? body, string headerName, object? headerValue, CancellationToken ct = default)
SendBodyAndHeaders(IRouteContext, string, object?, IEnumerable<KeyValuePair<string, object?>>, CancellationToken)
Sends body with the given headers to endpointUri (in-only).
public static Task SendBodyAndHeaders(this IRouteContext context, string endpointUri, object? body, IEnumerable<KeyValuePair<string, object?>> headers, CancellationToken ct = default)