WindowsDevicePortalWrapper  0.9.0.0
A client library that wraps the Windows Device Portal REST APIs.
Public Member Functions | List of all members
Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder Class Reference

Mock implementation of HttpWrapper. More...

Public Member Functions

void ResetMockResponses ()
 Clears all mock responses. Used between tests to ensure mocks don't interfere with other tests. More...
 
void AddMockResponse (string endpoint, HttpResponseMessage response, HttpMethods httpMethod)
 Adds a given response as a mock for the endpoint. More...
 
void AddMockResponse (string endpoint, DevicePortalPlatforms platform, string friendlyOperatingSystemVersion, HttpMethods httpMethod)
 Adds a response for this endpoint, loading from the file matching the deviceType and OsVersion More...
 
void AddMockResponse (string endpoint, HttpMethods httpMethod)
 Adds a default response for this endpoint, device agnostic. More...
 
async Task< HttpResponseMessage > GetAsync (Uri uri)
 Abstract method Mock Implementation More...
 
async Task< HttpResponseMessage > PostAsync (Uri uri, HttpContent content)
 Abstract method Mock Implementation More...
 
async Task< HttpResponseMessage > PutAsync (Uri uri, HttpContent content)
 Abstract method Mock Implementation More...
 
async Task< HttpResponseMessage > DeleteAsync (Uri uri)
 Abstract method Mock Implementation More...
 
async Task< HttpResponseMessage > WebSocketAsync (Uri uri)
 Abstract method Mock Implementation More...
 

Detailed Description

Mock implementation of HttpWrapper.

Member Function Documentation

void Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.AddMockResponse ( string  endpoint,
HttpResponseMessage  response,
HttpMethods  httpMethod 
)
inline

Adds a given response as a mock for the endpoint.

Parameters
endpointThe endpoint to be mocked.
responseThe response to return.
httpMethodHTTP method we are mocking.
void Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.AddMockResponse ( string  endpoint,
DevicePortalPlatforms  platform,
string  friendlyOperatingSystemVersion,
HttpMethods  httpMethod 
)
inline

Adds a response for this endpoint, loading from the file matching the deviceType and OsVersion

Parameters
endpointEndpoint we are mocking.
platformDevice platform we are testing.
friendlyOperatingSystemVersionThe friendly name of the OS Version we are testing, used to find the mock file.
httpMethodHTTP method we are mocking.
void Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.AddMockResponse ( string  endpoint,
HttpMethods  httpMethod 
)
inline

Adds a default response for this endpoint, device agnostic.

Parameters
endpointEndpoint we are mocking.
httpMethodHTTP method we are mocking.
async Task<HttpResponseMessage> Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.DeleteAsync ( Uri  uri)
inline

Abstract method Mock Implementation

Parameters
uriThe target URI.
Returns
Async task returning the response.
async Task<HttpResponseMessage> Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.GetAsync ( Uri  uri)
inline

Abstract method Mock Implementation

Parameters
uriThe target URI.
Returns
Async task returning the response.
async Task<HttpResponseMessage> Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.PostAsync ( Uri  uri,
HttpContent  content 
)
inline

Abstract method Mock Implementation

Parameters
uriThe target URI.
contentThe HTTP body of the request.
Returns
Async task returning the response.
async Task<HttpResponseMessage> Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.PutAsync ( Uri  uri,
HttpContent  content 
)
inline

Abstract method Mock Implementation

Parameters
uriThe target URI.
contentThe HTTP body of the request.
Returns
Async task returning the response.
void Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.ResetMockResponses ( )
inline

Clears all mock responses. Used between tests to ensure mocks don't interfere with other tests.

async Task<HttpResponseMessage> Microsoft.Tools.WindowsDevicePortal.Tests.MockHttpResponder.WebSocketAsync ( Uri  uri)
inline

Abstract method Mock Implementation

Parameters
uriThe target URI.
Returns
Async task returning the response.

The documentation for this class was generated from the following file: