• Stubbery
Show / Hide Table of Contents

Interface IConditionSetup

Represents the different preconditions that can be set on stubs.

Namespace: Stubbery.RequestMatching
Assembly: Stubbery.dll
Syntax
public interface IConditionSetup

Methods

| Improve this Doc View Source

IfAccept(Func<String, Boolean>)

Sets up a condition so that the stub only responds if the Accept header satisfy the check condition.

Declaration
ISetup IfAccept(Func<string, bool> check)
Parameters
Type Name Description
System.Func<System.String, System.Boolean> check

The condition the Accept header has to satisfy.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfAccept(String)

Sets up a condition so that the stub only responds if the request has the Accept header.

Declaration
ISetup IfAccept(string accept)
Parameters
Type Name Description
System.String accept

The required value of the Accept header.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfBody(Func<String, Boolean>)

Sets up a condition so that the stub only responds if the Body satisfies the check condition.

Declaration
ISetup IfBody(Func<string, bool> check)
Parameters
Type Name Description
System.Func<System.String, System.Boolean> check

The condition the Body has to satisfy.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfContentType(Func<String, Boolean>)

Sets up a condition so that the stub only responds if the Content-Type satisfies the check condition.

Declaration
ISetup IfContentType(Func<string, bool> check)
Parameters
Type Name Description
System.Func<System.String, System.Boolean> check

The condition the Content-Type have to satisfy.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfContentType(String)

Sets up a condition so that the stub only responds if the request has the specified Content-Type.

Declaration
ISetup IfContentType(string contentType)
Parameters
Type Name Description
System.String contentType

The required value of the Content-Type.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfHeader(String, String)

Sets up a condition so that the stub only responds if the request has the specified header.

Declaration
ISetup IfHeader(string header, string value)
Parameters
Type Name Description
System.String header

The name of the required header.

System.String value

The value of the required header.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfHeaders(Func<IHeaderDictionary, Boolean>)

Sets up a condition so that the stub only responds if the request headers satisfy the check condition.

Declaration
ISetup IfHeaders(Func<IHeaderDictionary, bool> check)
Parameters
Type Name Description
System.Func<Microsoft.AspNetCore.Http.IHeaderDictionary, System.Boolean> check

The condition the headers have to satisfy.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfQueryArg(String, String)

Sets up a condition so that the stub only responds if the query string argument argName has the value argValue.

Declaration
ISetup IfQueryArg(string argName, string argValue)
Parameters
Type Name Description
System.String argName
System.String argValue
Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

| Improve this Doc View Source

IfRoute(String)

Sets up a condition so that the stub only responds if the route of the request matches the routeTemplate.

Declaration
ISetup IfRoute(string routeTemplate)
Parameters
Type Name Description
System.String routeTemplate

The route template we want to match with the requests.

Returns
Type Description
ISetup

The same ISetup-instance, so that more conditions can be set fluently.

Remarks

If a route template gets matched, the route arguments are stored in the Microsoft.AspNetCore.Http.HttpContext, and they can be accessed through the Route property when creating responses.

If multiple routes are set up, then they'll be matched one by one until the first match found. The route arguments in Route will be populated based on the first match.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018 Mark Vincze
Generated by DocFX