Class FakeApiCall (4.3.1)

public static class FakeApiCall

Helper class to use when faking services; enables ApiCall<TRequest, TResponse> objects to be created without gRPC

Inheritance

object > FakeApiCall

Namespace

GoogleGoogle.ApiGaxGrpcTesting

Assembly

Google.Api.Gax.Grpc.Testing.dll

Methods

Create<TRequest, TResponse>(Func<TRequest, CallOptions, TResponse>, CallSettings, IClock)

public static ApiCall<TRequest, TResponse> Create<TRequest, TResponse>(Func<TRequest, CallOptions, TResponse> syncCall, CallSettings baseCallSettings = null, IClock clock = null) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Creates an API call from a synchronous function, which is just called synchronously for asynchronous requests.

Parameters
NameDescription
syncCallFuncCallOptions

Function to call for sync requests

baseCallSettingsCallSettings

The default call settings. May be null.

clockIClock

The clock to use; defaults to a new FakeClock.

Returns
TypeDescription
ApiCall

The new API call.

Type Parameters
NameDescription
TRequest

Request type

TResponse

Response type

Remarks

For asynchronous requests, the synchronous function is called but within an async context; exceptions will still be reported back via the returned task, but the call will complete synchronously.

Create<TRequest, TResponse>(Func<TRequest, CallOptions, Task<TResponse>>, Func<TRequest, CallOptions, TResponse>, CallSettings, IClock)

public static ApiCall<TRequest, TResponse> Create<TRequest, TResponse>(Func<TRequest, CallOptions, Task<TResponse>> asyncCall, Func<TRequest, CallOptions, TResponse> syncCall, CallSettings baseCallSettings = null, IClock clock = null) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Creates an API call from the given async/sync functions.

Parameters
NameDescription
asyncCallFuncCallOptionsTask

Function to call for async requests

syncCallFuncCallOptions

Function to call for sync requests

baseCallSettingsCallSettings

The default call settings. May be null.

clockIClock

The clock to use; defaults to a new FakeClock.

Returns
TypeDescription
ApiCall

The new API call.

Type Parameters
NameDescription
TRequest

Request type

TResponse

Response type