Interface IResultSetup
Represents the response arguments which can be customized for stubs.
Namespace: Stubbery.RequestMatching
Assembly: Stubbery.dll
Syntax
public interface IResultSetup
Methods
| Improve this Doc View SourceDelay(Func<HttpRequest, RequestArguments, TimeSpan>)
Introduce a response delay
Declaration
ISetup Delay(Func<HttpRequest, RequestArguments, TimeSpan> delayProvider)
Parameters
Type | Name | Description |
---|---|---|
System.Func<Microsoft.AspNetCore.Http.HttpRequest, RequestArguments, System.TimeSpan> | delayProvider | The function which provides the delay based on the request. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Delay(TimeSpan)
Introduce a response delay
Declaration
ISetup Delay(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | delay | The delay to introduce. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Header(Func<HttpRequest, RequestArguments, (String, String)>)
Sets the function providing a header to be added to the stub response.
Declaration
ISetup Header(Func<HttpRequest, RequestArguments, (string, string)> headerProvider)
Parameters
Type | Name | Description |
---|---|---|
System.Func<Microsoft.AspNetCore.Http.HttpRequest, RequestArguments, System.ValueTuple<System.String, System.String>> | headerProvider | The function which provides the header based on the request. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Header(String, String)
Sets a header to be added to the stub response.
Declaration
ISetup Header(string header, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | header | The name of the header to be added to the response. |
System.String | value | The value of the header to be added to the response. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Headers(Func<HttpRequest, RequestArguments, (String, String)[]>)
Sets the function providing headers to be added to the stub response.
Declaration
ISetup Headers(Func<HttpRequest, RequestArguments, (string, string)[]> headersProvider)
Parameters
Type | Name | Description |
---|---|---|
System.Func<Microsoft.AspNetCore.Http.HttpRequest, RequestArguments, System.ValueTuple<System.String, System.String>[]> | headersProvider | The function which provides the headers based on the request. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Headers((String, String)[])
Sets the given headers to be added to the response.
Declaration
ISetup Headers(params (string, string)[] headers)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<System.String, System.String>[] | headers | The headers to be added to the response. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Response(CreateStubResponse)
Sets up the response to be sent by the stubbed endpoint.
Declaration
ISetup Response(CreateStubResponse responder)
Parameters
Type | Name | Description |
---|---|---|
CreateStubResponse | responder | The delegate that is called to create the response. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
Remarks
The object returned by the responder
delegate must be a string. That string will be directly written to the response body.
StatusCode(Func<HttpRequest, RequestArguments, Int32>)
Sets the function providing the status code of the stub response.
Declaration
ISetup StatusCode(Func<HttpRequest, RequestArguments, int> statusCodeProvider)
Parameters
Type | Name | Description |
---|---|---|
System.Func<Microsoft.AspNetCore.Http.HttpRequest, RequestArguments, System.Int32> | statusCodeProvider | The function which provides the status code based on the request. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |
StatusCode(Int32)
Sets the status code of the stub response.
Declaration
ISetup StatusCode(int statusCode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | The status code to be set on the response. |
Returns
Type | Description |
---|---|
ISetup | The same ISetup-instance, so that more parameters can be set fluently. |