C# Класс NUnit.Extensions.Asp.HttpClient

A web client, capable of communicating with a web server.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Credentials ICredentials
Default HttpClient
Proxy IWebProxy
UrlReferrer System.Uri
UserAgent string
UserLanguages string[]

Private Properties

Свойство Тип Описание
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

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

CookieValue() публичный Метод

Returns the value of a cookie. Throws exception if the cookie hasn't been set.
public CookieValue ( string cookieName ) : string
cookieName string
Результат string

FollowLink() публичный Метод

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
Результат void

GetPage() публичный Метод

Retrieves a page from a web server.
public GetPage ( string url ) : void
url string The URL of the page to get.
Результат void

HasCookie() публичный Метод

Checks to see if a cookie has been set.
public HasCookie ( string cookieName ) : bool
cookieName string The name of the cookie.
Результат bool

Описание свойств

Credentials публичное свойство

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
Результат ICredentials

Default публичное статическое свойство

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
Результат HttpClient

Proxy публичное свойство

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
Результат IWebProxy

UrlReferrer публичное свойство

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
Результат System.Uri

UserAgent публичное свойство

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
Результат string

UserLanguages публичное свойство

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
Результат string[]