Class MockedResponseExtensions
- Namespace
- Fluxzy.Rules.Actions.HighLevelActions
- Assembly
- Fluxzy.Core.dll
public static class MockedResponseExtensions
- Inheritance
-
MockedResponseExtensions
- Inherited Members
Methods
ReplyByteArray(IConfigureActionBuilder, byte[], int, string?, params (string, string)[])
Configures a mocked response that returns a byte array content.
public static IConfigureFilterBuilder ReplyByteArray(this IConfigureActionBuilder actionBuilder, byte[] bytes, int statusCode = 200, string? contentType = "application/octet-stream", params (string, string)[] headers)
Parameters
actionBuilderIConfigureActionBuilderThe action builder.
bytesbyte[]The byte array content to be returned.
statusCodeintThe HTTP status code to be returned. The default value is 200.
contentTypestringThe content type of the response. The default value is "application/octet-stream".
headers(string, string)[]The additional headers to be included in the response.
Returns
- IConfigureFilterBuilder
The configure filter builder.
ReplyFile(IConfigureActionBuilder, string, int, string?, params (string, string)[])
Generates a mocked response for a file and configures it as a response action for a given action builder.
public static IConfigureFilterBuilder ReplyFile(this IConfigureActionBuilder actionBuilder, string fileName, int statusCode = 200, string? contentType = null, params (string, string)[] headers)
Parameters
actionBuilderIConfigureActionBuilderThe action builder to configure.
fileNamestringThe name of the file to generate a response from.
statusCodeintThe HTTP status code for the response (default is 200).
contentTypestringThe content type of the response (default is null).
headers(string, string)[]Additional headers to be included in the response (default is null).
Returns
- IConfigureFilterBuilder
An instance of IConfigureFilterBuilder for further configuration.
ReplyJson(IConfigureActionBuilder, string, int, params (string, string)[])
Sets up a mocked response with JSON content.
public static IConfigureFilterBuilder ReplyJson(this IConfigureActionBuilder actionBuilder, string json, int statusCode = 200, params (string, string)[] headers)
Parameters
actionBuilderIConfigureActionBuilderThe action builder.
jsonstringThe JSON content to be returned.
statusCodeintThe HTTP status code of the response. Default is 200.
headers(string, string)[]The custom headers to be included in the response.
Returns
- IConfigureFilterBuilder
A configure filter builder for further configuration.
ReplyJsonFile(IConfigureActionBuilder, string, int, params (string, string)[])
Generates a mocked response with JSON content from a file and configures the action builder to reply with the generated response.
public static IConfigureFilterBuilder ReplyJsonFile(this IConfigureActionBuilder actionBuilder, string fileName, int statusCode = 200, params (string, string)[] headers)
Parameters
actionBuilderIConfigureActionBuilderThe action builder to configure.
fileNamestringThe name of the file that contains the JSON content.
statusCodeintThe status code to be set in the response. Default is 200.
headers(string, string)[]Additional headers to be included in the response.
Returns
- IConfigureFilterBuilder
A configure filter builder instance.
ReplyText(IConfigureActionBuilder, string, int, string?, params (string, string)[])
Configures the simulated response with text content.
public static IConfigureFilterBuilder ReplyText(this IConfigureActionBuilder actionBuilder, string text, int statusCode = 200, string? contentType = "text/plain", params (string, string)[] headers)
Parameters
actionBuilderIConfigureActionBuilderThe action builder.
textstringThe text content to be returned.
statusCodeintThe HTTP status code of the response. Default is 200.
contentTypestringThe content type of the response. Default is "text/plain".
headers(string, string)[]The headers to be added to the response.
Returns
- IConfigureFilterBuilder
A configured filter builder.