C# Class NUnit.Extensions.Asp.HttpClient

A web client, capable of communicating with a web server.
Afficher le fichier Open project: vcsjones/NUnitAsp Class Usage Examples

Méthodes publiques

Свойство Type Description
Credentials ICredentials
Default HttpClient
Proxy IWebProxy
UrlReferrer System.Uri
UserAgent string
UserLanguages string[]

Private Properties

Свойство Type Description
AddUserLanguageHeaders void
CreateRequest System.Net.HttpWebRequest
DoWebRequest void
GetRedirectUrl string
GetUrlFromResponse System.Uri
ParseStackTrace string
ReadHttpResponse void
SendRequest System.Net.HttpWebResponse
SubmitForm void
TrackUrlReferrer void
TrimFragmentIdentifier string
UpdateCredentialsFromUrl void
UpdateCurrentUrl void
WriteRequestBody void

Méthodes publiques

Méthode Description
CookieValue ( string cookieName ) : string

Returns the value of a cookie. Throws exception if the cookie hasn't been set.

FollowLink ( string url ) : void

Retrieves a page from a web server. Different from GetPage in that it sets the current page as the referrer. You should use normally use GetPage.

GetPage ( string url ) : void

Retrieves a page from a web server.

HasCookie ( string cookieName ) : bool

Checks to see if a cookie has been set.

Private Methods

Méthode Description
AddUserLanguageHeaders ( HttpWebRequest request ) : void
CreateRequest ( string method, string formVariables ) : HttpWebRequest
DoWebRequest ( string url, string method, string formVariables ) : void
GetRedirectUrl ( HttpWebResponse response ) : string
GetUrlFromResponse ( HttpWebResponse response ) : Uri
ParseStackTrace ( string aspExceptionPageHtml ) : string

Returns null if stack trace couldn't be found.

ReadHttpResponse ( HttpWebResponse response ) : void
SendRequest ( HttpWebRequest request ) : HttpWebResponse
SubmitForm ( WebFormTester form ) : void
TrackUrlReferrer ( ) : void
TrimFragmentIdentifier ( string url ) : string
UpdateCredentialsFromUrl ( ) : void
UpdateCurrentUrl ( string url, bool isGet, string formVariables ) : void
WriteRequestBody ( HttpWebRequest request, string formVariables ) : void

Method Details

CookieValue() public méthode

Returns the value of a cookie. Throws exception if the cookie hasn't been set.
public CookieValue ( string cookieName ) : string
cookieName string
Résultat string

FollowLink() public méthode

Retrieves a page from a web server. Different from GetPage in that it sets the current page as the referrer. You should use normally use GetPage.
public FollowLink ( string url ) : void
url string
Résultat void

GetPage() public méthode

Retrieves a page from a web server.
public GetPage ( string url ) : void
url string The URL of the page to get.
Résultat void

HasCookie() public méthode

Checks to see if a cookie has been set.
public HasCookie ( string cookieName ) : bool
cookieName string The name of the cookie.
Résultat bool

Property Details

Credentials public_oe property

Username and password (null if none). Set automatically if the username and password are supplied in the URL (i.e., "http://username:password@host"). Can be used with both "basic" and "Windows Integrated" (NTLM) authentication methods. Set this property to CredentialCache.DefaultCredentials to use your current Windows login.
public ICredentials Credentials
Résultat ICredentials

Default public_oe static_oe property

The HttpClient that's used by default in all tests.

If you're creating a custom tester, don't use this property! Use ControlTester.ControlTester.Browser instead.

public static HttpClient,NUnit.Extensions.Asp Default
Résultat HttpClient

Proxy public_oe property

The proxy server information to use to proxy HTTP requests. If this property is set to null, the default value returned by GlobalProxySelection.Select is used.
public IWebProxy Proxy
Résultat IWebProxy

UrlReferrer public_oe property

URL containing the hyperlink or form that caused the browser to load the current url (null if none). Fragments aren't included (the part of the URL that comes after a '#').
public Uri,System UrlReferrer
Résultat System.Uri

UserAgent public_oe property

The user-agent string to send to the server. Useful if you want to pretend to be a specific browser. Defaults to IE_USER_AGENT.

Be careful when changing this, as ASP.NET renders controls differently for different user agents. NUnitAsp's testers may not be able to recognize a control that was rendered for a different browser.

public string UserAgent
Résultat string

UserLanguages public_oe property

The language-tag elements to send to the server (null if none). These appear in the Request.UserLanguages array in the target page.
public string[] UserLanguages
Résultat string[]