C# Class NUnit.Extensions.Asp.WebFormTester

A tester for an ASP.NET form. Most of the methods in this class aren't meant to be called by third parties.

The API for this class will change in future releases.

Inheritance: Tester
ファイルを表示 Open project: vcsjones/NUnitAsp Class Usage Examples

Public Methods

Method Description
IsPostBack ( string candidatePostBackScript ) : bool

Checks a string to see if it contains a post-back script. Typically you should just use OptionalPostBack instead.

OptionalPostBack ( string candidatePostBackScript ) : void

Like PostBack, except that it does nothing if candidatePostBackScript doesn't contain a post-back script.

PostBack ( string postBackScript ) : void

Emulates ASP.NET's post-back script (often seen as a Javascript "__doPostBack" call). To simply submit the form, use Submit instead. If you don't have access to the JavaScript call, use PostBack(string, string) instead. This method throws an exception if the postBackScript string isn't actually a post-back script (for example, if it's an empty string). Use OptionalPostBack if the string isn't expected to contain a post-back script all of the time.

PostBack ( string eventTarget, string eventArgument ) : void

Emulates ASP.NET's post-back script. To simply submit the form, use Submit instead. If you have access to the JavaScript call string, use OptionalPostBack or the other form of PostBack(string).

Submit ( ) : void

Submit this form to the server.

WebFormTester ( HttpClient browser ) : System

Create the tester and link it to an ASP.NET web form.

WebFormTester ( string aspId, HttpClient browser ) : System

Protected Methods

Method Description
GetChildElementHtmlId ( string aspId ) : string

Returns the HTML ID of a child control. Useful when implementing testers for container controls that do HTML ID mangling. This method is very likely to change in a future release.

Private Methods

Method Description
FindTagByForm ( ) : HtmlTagTester
FindTagById ( ) : HtmlTagTester
TryPostBack ( string postBackScript, string postBackPattern ) : bool

Method Details

GetChildElementHtmlId() protected method

Returns the HTML ID of a child control. Useful when implementing testers for container controls that do HTML ID mangling. This method is very likely to change in a future release.
protected GetChildElementHtmlId ( string aspId ) : string
aspId string
return string

IsPostBack() public method

Checks a string to see if it contains a post-back script. Typically you should just use OptionalPostBack instead.
public IsPostBack ( string candidatePostBackScript ) : bool
candidatePostBackScript string
return bool

OptionalPostBack() public method

Like PostBack, except that it does nothing if candidatePostBackScript doesn't contain a post-back script.
public OptionalPostBack ( string candidatePostBackScript ) : void
candidatePostBackScript string
return void

PostBack() public method

Emulates ASP.NET's post-back script (often seen as a Javascript "__doPostBack" call). To simply submit the form, use Submit instead. If you don't have access to the JavaScript call, use PostBack(string, string) instead. This method throws an exception if the postBackScript string isn't actually a post-back script (for example, if it's an empty string). Use OptionalPostBack if the string isn't expected to contain a post-back script all of the time.
public PostBack ( string postBackScript ) : void
postBackScript string
return void

PostBack() public method

Emulates ASP.NET's post-back script. To simply submit the form, use Submit instead. If you have access to the JavaScript call string, use OptionalPostBack or the other form of PostBack(string).
public PostBack ( string eventTarget, string eventArgument ) : void
eventTarget string The "event target" parameter for the post-back script.
eventArgument string The "event argument" parameter for the post-back script.
return void

Submit() public method

Submit this form to the server.
public Submit ( ) : void
return void

WebFormTester() public method

Create the tester and link it to an ASP.NET web form.
public WebFormTester ( HttpClient browser ) : System
browser HttpClient The browser used to load this page.
return System

WebFormTester() public method

public WebFormTester ( string aspId, HttpClient browser ) : System
aspId string
browser HttpClient
return System