Class TableauApiResponseSimulator
Default IResponseSimulator implementation.
Implements
Namespace: Tableau.Migration.Api.Simulation
Assembly: Tableau.Migration.dll
Syntax
public class TableauApiResponseSimulator : IResponseSimulator
Constructors
TableauApiResponseSimulator(Uri, TableauData, IHttpContentSerializer)
Creates a new TableauApiResponseSimulator object.
Declaration
public TableauApiResponseSimulator(Uri baseUrl, TableauData data, IHttpContentSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
Uri | baseUrl | The base URL to respond to. |
TableauData | data | The simulated data. |
IHttpContentSerializer | serializer | A serializer to use. |
Properties
BaseUrl
Gets the base URL to match requests on.
Declaration
public Uri BaseUrl { get; }
Property Value
Type | Description |
---|---|
Uri |
Data
Gets the simulated data.
Declaration
public TableauData Data { get; }
Property Value
Type | Description |
---|---|
TableauData |
Serializer
Gets the serializer to use for responses.
Declaration
public IHttpContentSerializer Serializer { get; }
Property Value
Type | Description |
---|---|
IHttpContentSerializer |
Methods
RespondAsync(HttpRequestMessage, CancellationToken)
Creates a simulated response for the request.
Declaration
public Task<HttpResponseMessage> RespondAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | The request to respond to. |
CancellationToken | cancellationToken | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> | The simulated response message. |
SetupMethod(MethodSimulator)
Configures the simulated response for an API method.
Declaration
public TableauApiResponseSimulator SetupMethod(MethodSimulator method)
Parameters
Type | Name | Description |
---|---|---|
MethodSimulator | method | The simulated API method. |
Returns
Type | Description |
---|---|
TableauApiResponseSimulator | This response simulator, for fluent API usage. |
SetupResponse(HttpMethod, Uri, IResponseBuilder)
Configures a simulated response.
Declaration
public TableauApiResponseSimulator SetupResponse(HttpMethod httpMethod, Uri requestUrl, IResponseBuilder response)
Parameters
Type | Name | Description |
---|---|---|
HttpMethod | httpMethod | The HTTP method to match. |
Uri | requestUrl | The request URL to match. |
IResponseBuilder | response | The response builder to use. |
Returns
Type | Description |
---|---|
TableauApiResponseSimulator | This response simulator, for fluent API usage. |