Show / Hide Table of Contents

Interface ISimulatedHttp

Simulates HttpClient transactions for testing and providing mock data

Namespace: BlazorFocused.Tools
Assembly: BlazorFocused.Tools.dll
Syntax
public interface ISimulatedHttp

Properties

| Improve this Doc View Source

DelegatingHandler

Handler that can be passed into System.Net.Http.HttpClient for making simulated requests

Declaration
DelegatingHandler DelegatingHandler { get; }
Property Value
Type Description
DelegatingHandler
| Improve this Doc View Source

HttpClient

Returns System.Net.Http.HttpClient to perform requests

Declaration
HttpClient HttpClient { get; }
Property Value
Type Description
HttpClient

Methods

| Improve this Doc View Source

GetRequestHeaderValues(HttpMethod, String, String)

Retrieve header values under specified key for a given request

Declaration
IEnumerable<string> GetRequestHeaderValues(HttpMethod method, string url, string key)
Parameters
Type Name Description
HttpMethod method

Http Method of which request was made

System.String url

Url of which request was made

System.String key

Header key for values to obtain

Returns
Type Description
IEnumerable<System.String>
| Improve this Doc View Source

SetupDELETE(String)

Begin setup for an expected DELETE request that will be used

Declaration
ISimulatedHttpSetup SetupDELETE(string url)
Parameters
Type Name Description
System.String url

Relative or full url expected request

Returns
Type Description
ISimulatedHttpSetup

Further configuration to handle simulated response object

| Improve this Doc View Source

SetupGET(String)

Begin setup for an expected GET request that will be used

Declaration
ISimulatedHttpSetup SetupGET(string url)
Parameters
Type Name Description
System.String url

Relative or full url expected request

Returns
Type Description
ISimulatedHttpSetup

Further configuration to handle simulated response object

| Improve this Doc View Source

SetupPATCH(String, Object)

Begin setup for an expected PATCH request that will be used

Declaration
ISimulatedHttpSetup SetupPATCH(string url, object content = null)
Parameters
Type Name Description
System.String url

Relative or full url expected request

System.Object content

Request body of expected request (will not compare if null)

Returns
Type Description
ISimulatedHttpSetup

Further configuration to handle simulated response object

| Improve this Doc View Source

SetupPOST(String, Object)

Begin setup for an expected POST request that will be used

Declaration
ISimulatedHttpSetup SetupPOST(string url, object content = null)
Parameters
Type Name Description
System.String url

Relative or full url expected request

System.Object content

Request body of expected request (will not compare if null)

Returns
Type Description
ISimulatedHttpSetup

Further configuration to handle simulated response object

| Improve this Doc View Source

SetupPUT(String, Object)

Begin setup for an expected PUT request that will be used

Declaration
ISimulatedHttpSetup SetupPUT(string url, object content = null)
Parameters
Type Name Description
System.String url

Relative or full url expected request

System.Object content

Request body of expected request (will not compare if null)

Returns
Type Description
ISimulatedHttpSetup

Further configuration to handle simulated response object

| Improve this Doc View Source

VerifyDELETEWasCalled(String)

Verify a DELETE request was made

Declaration
void VerifyDELETEWasCalled(string url = null)
Parameters
Type Name Description
System.String url

Expected relative or full url

Exceptions
Type Condition
BlazorFocused.Tools.SimulatedHttpTestException

Exception will be thrown if expected request was not performed

| Improve this Doc View Source

VerifyGETWasCalled(String)

Verify a GET request was made

Declaration
void VerifyGETWasCalled(string url = null)
Parameters
Type Name Description
System.String url

Expected relative or full url

Exceptions
Type Condition
BlazorFocused.Tools.SimulatedHttpTestException

Exception will be thrown if expected request was not performed

| Improve this Doc View Source

VerifyPATCHWasCalled(String, Object)

Verify PATCH request was made

Declaration
void VerifyPATCHWasCalled(string url = null, object content = null)
Parameters
Type Name Description
System.String url

Expected relative or full url

System.Object content

Expected request object

Exceptions
Type Condition
BlazorFocused.Tools.SimulatedHttpTestException

Exception will be thrown if expected request was not performed

| Improve this Doc View Source

VerifyPOSTWasCalled(String, Object)

Verify POST request was made

Declaration
void VerifyPOSTWasCalled(string url = null, object content = null)
Parameters
Type Name Description
System.String url

Expected relative or full url

System.Object content

Expected request object

Exceptions
Type Condition
BlazorFocused.Tools.SimulatedHttpTestException

Exception will be thrown if expected request was not performed

| Improve this Doc View Source

VerifyPUTWasCalled(String, Object)

Verify PUT request was made

Declaration
void VerifyPUTWasCalled(string url = null, object content = null)
Parameters
Type Name Description
System.String url

Expected relative or full url

System.Object content

Expected request object

Exceptions
Type Condition
BlazorFocused.Tools.SimulatedHttpTestException

Exception will be thrown if expected request was not performed

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX