C# Class NUnit.Extensions.Asp.FormVariables

A collection of HTML form variables. These form variables are sent to the server when you submit or postback a form. They consist of a name/value pair and are not required to be unique. You may include duplicate names or even duplicate name/value pairs in this collection. When writing custom testers, ReplaceAll and RemoveAll are typically the most appropriate methods to use.
显示文件 Open project: vcsjones/NUnitAsp Class Usage Examples

Public Methods

Method Description
Add ( string name, string value ) : void

Add a name/value pair. Add doesn't overwrite any existing pairs with the same name, so in most cases, ReplaceAll is more appropriate.

AllValuesOf ( string name ) : string[]

Returns all the values associated with the specified name. Returns an empty (zero-length) array if there aren't any. ValueOf is more convenient when there's exactly one name/value pair with the specified name.

Contains ( string name, string value ) : bool

Check if a name/value pair is in the collection. It could exist more than once.

ContainsAny ( string name ) : bool

Check if a particular name has any values. There could be more than one name/value pair with the specified name.

Remove ( string name, string value ) : void

Remove a specific name/value pair. If the pair is in the collection more than once, this method will only remove one of them.

RemoveAll ( string name ) : void

Remove all form variables with a particular name.

Replace ( string name, string oldValue, string newValue ) : void

Replace a specific name/value pair.

ReplaceAll ( string name, string newValue ) : void

Replace all form variables with a particular name. This is the same as calling RemoveAll and then Add.

ToString ( ) : string

Serializes all the name/value pairs into a string. The format of the string matches the HTTP protocol specification for transmitting form variables to a server. This can be handy for checking the form variables in your web page. Generally you won't be sending it to a server because HttpClient handles that for you.

ValueOf ( string name ) : string

Returns the value of the name/value pair with the specified name. Throws an exception if there aren't any pairs with that name or if there's more than one. Use AllValuesOf to handle cases where there isn't exactly one name/value pair with the requested name.

Private Methods

Method Description
AllIndexesOf ( string name ) : ArrayList
IndexOf ( string name, string value ) : int

Method Details

Add() public method

Add a name/value pair. Add doesn't overwrite any existing pairs with the same name, so in most cases, ReplaceAll is more appropriate.
public Add ( string name, string value ) : void
name string
value string
return void

AllValuesOf() public method

Returns all the values associated with the specified name. Returns an empty (zero-length) array if there aren't any. ValueOf is more convenient when there's exactly one name/value pair with the specified name.
public AllValuesOf ( string name ) : string[]
name string
return string[]

Contains() public method

Check if a name/value pair is in the collection. It could exist more than once.
public Contains ( string name, string value ) : bool
name string
value string
return bool

ContainsAny() public method

Check if a particular name has any values. There could be more than one name/value pair with the specified name.
public ContainsAny ( string name ) : bool
name string
return bool

Remove() public method

Remove a specific name/value pair. If the pair is in the collection more than once, this method will only remove one of them.
public Remove ( string name, string value ) : void
name string
value string
return void

RemoveAll() public method

Remove all form variables with a particular name.
public RemoveAll ( string name ) : void
name string
return void

Replace() public method

Replace a specific name/value pair.
public Replace ( string name, string oldValue, string newValue ) : void
name string
oldValue string
newValue string
return void

ReplaceAll() public method

Replace all form variables with a particular name. This is the same as calling RemoveAll and then Add.
public ReplaceAll ( string name, string newValue ) : void
name string
newValue string
return void

ToString() public method

Serializes all the name/value pairs into a string. The format of the string matches the HTTP protocol specification for transmitting form variables to a server. This can be handy for checking the form variables in your web page. Generally you won't be sending it to a server because HttpClient handles that for you.
public ToString ( ) : string
return string

ValueOf() public method

Returns the value of the name/value pair with the specified name. Throws an exception if there aren't any pairs with that name or if there's more than one. Use AllValuesOf to handle cases where there isn't exactly one name/value pair with the requested name.
public ValueOf ( string name ) : string
name string
return string