Class MockCbmsHttpHandler
HttpMessageHandler that returns mock CBMS API responses. Token, ping, and check-enrollment return static embedded JSON and do not need a data store. Phone lookup (get-account-details) and PATCH (update-std-dtls) require MockCbmsDataStore.
public sealed class MockCbmsHttpHandler : HttpMessageHandler
- Inheritance
-
objectHttpMessageHandlerMockCbmsHttpHandler
Constructors
MockCbmsHttpHandler()
Handler for static mock responses (token, ping, check-enrollment).
public MockCbmsHttpHandler()
MockCbmsHttpHandler(MockCbmsDataStore)
public MockCbmsHttpHandler(MockCbmsDataStore dataStore)
Parameters
dataStoreMockCbmsDataStore
Methods
Send(HttpRequestMessage, CancellationToken)
When overridden in a derived class, sends an HTTP request with the specified request and cancellation token. Otherwise, throws a System.NotSupportedException.
protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send.
cancellationTokenCancellationTokenThe cancellation token to cancel operation.
Returns
- HttpResponseMessage
The HTTP response message.
Exceptions
- NotSupportedException
The method is not overridden in the derived class.
- OperationCanceledException
The cancellation token was canceled. This exception is stored into the returned task.
SendAsync(HttpRequestMessage, CancellationToken)
Send an HTTP request as an asynchronous operation.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send.
cancellationTokenCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
requestwas null.- OperationCanceledException
The cancellation token was canceled. This exception is stored into the returned task.