C# 클래스 Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.MockHttpServer

A mock server implementation for capturing and replaying Http Web Requests.
상속: IDisposable
파일 보기 프로젝트 열기: Azure/azure-powershell 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DefaultHttpsServerPrefixUri System.Uri
DefaultServerPrefixUri System.Uri

공개 메소드들

메소드 설명
CreateWebException ( HttpStatusCode status, MemoryStream content, Action contextHandler ) : WebException

Create a WebException with the specified content.

CreateWebException ( HttpStatusCode status, string content, Action contextHandler ) : WebException

Create a WebException with the specified content.

Dispose ( ) : void

Stop and closes the listener.

MockHttpServer ( AsyncExceptionManager exceptionManager, Uri baseUri, Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.HttpSession session ) : System

Initializes a new instance of the MockHttpServer class that record or playback responses for requests in a session.

SetupCertificates ( ) : void

Setup certificates required for the unit tests

비공개 메소드들

메소드 설명
ChangeUriBase ( Uri originalUri, Uri originalUriPrefix, Uri newPrefix ) : Uri

Returns the originalUri with its prefix changed from originalUriPrefix to newPrefix, or if the prefix is not in the originalUri, return the Uri as is.

ConstructListenerResponse ( HttpMessage responseInfo, Uri baseUri, HttpListenerResponse response ) : void

Constructs the response from the specified HttpMessage.Response.

ConstructRequestInfo ( HttpListenerRequest originalRequest ) : HttpMessage.Request

Create an HttpMessage.Request object out of the given originalRequest.

ConstructResponseInfo ( Uri serviceBaseUri, HttpWebResponse response ) : HttpMessage.Response

Create an HttpMessage.Response object out of the response from a service.

CreateListener ( Action contextHandler, int requestsToHandle ) : HttpListener

Create a HttpListener to handles requests.

ExecuteProcess ( string filename, string arguments ) : Process

Helper method to execute and wait for process to complete.

GetResponseInfoFromService ( HttpListenerRequest request, Uri baseUri, Uri serviceBaseUri, Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.HttpSession session ) : HttpMessage

Retrieves an HttpMessage object from a real service.

HandleMockRequest ( HttpListenerContext context, Uri baseUri, Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.HttpSession session ) : void

The async delegate that handles an incoming request, passing it through to a real service and record the response if serviceBaseUri was specified, or plays back responses from a pre-recorded session if it was not.

HandleRequest ( IAsyncResult ar, Action contextHandler, int requestsToHandle ) : void

The async delegate that handles an incoming request.

MakeServiceRequest ( HttpMessage originalRequest ) : HttpWebResponse

Make an request to the real service and retrieve the response.

MockHttpServer ( AsyncExceptionManager exceptionManager, Uri baseUri ) : System

Initializes a new instance of the MockHttpServer class with a specified server prefix.

메소드 상세

CreateWebException() 공개 정적인 메소드

Create a WebException with the specified content.
public static CreateWebException ( HttpStatusCode status, MemoryStream content, Action contextHandler ) : WebException
status HttpStatusCode The status code to use in the exception.
content System.IO.MemoryStream A of the exception content.
contextHandler Action An action that adds extra info to the response.
리턴 System.Net.WebException

CreateWebException() 공개 정적인 메소드

Create a WebException with the specified content.
public static CreateWebException ( HttpStatusCode status, string content, Action contextHandler ) : WebException
status HttpStatusCode The status code to use in the exception.
content string The exception content.
contextHandler Action An action that adds extra info to the response.
리턴 System.Net.WebException

Dispose() 공개 메소드

Stop and closes the listener.
public Dispose ( ) : void
리턴 void

MockHttpServer() 공개 메소드

Initializes a new instance of the MockHttpServer class that record or playback responses for requests in a session.
public MockHttpServer ( AsyncExceptionManager exceptionManager, Uri baseUri, Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.HttpSession session ) : System
exceptionManager AsyncExceptionManager /// The exception manager that captures all async exceptions. ///
baseUri System.Uri The server prefix to use.
session Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer.HttpSession The object that stores request/response information.
리턴 System

SetupCertificates() 공개 정적인 메소드

Setup certificates required for the unit tests
public static SetupCertificates ( ) : void
리턴 void

프로퍼티 상세

DefaultHttpsServerPrefixUri 공개적으로 정적으로 프로퍼티

The HTTPS server prefix for tests which is been used in cert auth based unit tests
public static Uri,System DefaultHttpsServerPrefixUri
리턴 System.Uri

DefaultServerPrefixUri 공개적으로 정적으로 프로퍼티

The HTTP server prefix for tests
public static Uri,System DefaultServerPrefixUri
리턴 System.Uri