C# Class NUnit.Extensions.Asp.AspTester.RepeaterTester

Tester for System.Web.UI.WebControls.Repeater. Generally, you don't test through this tester. Instead, you use the Item method to use as a container for testing controls that are inside the repeater. The ItemCount method may also be useful. This example demonstrates how to test a button that's in the third item of a repeater: RepeaterTester repeater = new RepeaterTester("repeater"); ButtonTester button = new ButtonTester("button", repeater.Item(2));
Inheritance: NamingContainerTester
Show file Open project: vcsjones/NUnitAsp Class Usage Examples

Public Methods

Method Description
Item ( int itemNum ) : RepeaterItemTester

Returns a container for testing controls within the repeater's ItemTemplate and AlternatingItemTemplate. The 'itemNum' is the item to look for. itemNum zero is the first instance of ItemTemplate; itemNum one is the second instance of ItemTemplate, or AlternatingItemTemplate if it's in use; etc. This method does NOT check to see if the repeater is visible or if the item number is legal on the current page. Instead, you'll get a NotVisibleException when you attempt to use the tester instantiated with the result of this method.

RepeaterTester ( string aspId ) : System

Create a tester for a top-level control. Use this constructor for testing most controls. Testers created with this constructor will test pages loaded by the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.

RepeaterTester ( string aspId, Tester container ) : System

Create a tester for a nested control. Use this constructor when the control you are testing is nested within another control, such as a DataGrid or UserControl. You should also use this constructor when you're not using the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.

RepeaterTester ( string aspId, bool hasHeaderTemplate, bool hasSeparatorTemplate, bool hasFooterTemplateContainingServerControl ) : System

Create a tester for a top-level control. Use this constructor for testing most controls. Testers created with this constructor will test pages loaded by the HttpClient.Default HttpClient.

RepeaterTester ( string aspId, bool hasHeaderTemplate, bool hasSeparatorTemplate, bool hasFooterTemplateContainingServerControl, Tester container ) : System

Create a tester for a nested control. Use this constructor when the control you are testing is nested within another control, such as a DataGrid or UserControl. You should also use this constructor when you're not using the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.

Separator ( int separatorNum ) : RepeaterSeparatorTester

Returns a container for testing controls within the repeater's SeparatorTemplate. The 'separatorNum' is the separator to look for. separatorNum zero is the first separator (between the first and second items); separatorNum one is the second separator (between the second and third items); etc. This method will NOT check to see if the repeater is visible or if it has a SeparatorTemplate. Instead, you'll get a NotVisibleException when you attempt to use the tester instantiated with the result of this method.

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.

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

Item() public method

Returns a container for testing controls within the repeater's ItemTemplate and AlternatingItemTemplate. The 'itemNum' is the item to look for. itemNum zero is the first instance of ItemTemplate; itemNum one is the second instance of ItemTemplate, or AlternatingItemTemplate if it's in use; etc. This method does NOT check to see if the repeater is visible or if the item number is legal on the current page. Instead, you'll get a NotVisibleException when you attempt to use the tester instantiated with the result of this method.
public Item ( int itemNum ) : RepeaterItemTester
itemNum int The item to get (zero-based)
return RepeaterItemTester

RepeaterTester() public method

Create a tester for a top-level control. Use this constructor for testing most controls. Testers created with this constructor will test pages loaded by the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.

public RepeaterTester ( string aspId ) : System
aspId string The ID of the control to test (look in the /// page's ASP.NET source code for the ID).
return System

RepeaterTester() public method

Create a tester for a nested control. Use this constructor when the control you are testing is nested within another control, such as a DataGrid or UserControl. You should also use this constructor when you're not using the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.
public RepeaterTester ( string aspId, Tester container ) : System
aspId string The ID of the control to test (look in the /// page's ASP.NET source code for the ID).
container Tester A tester for the control's container. /// (In the page's ASP.NET source code, look for the tag that the /// control is nested in. That's probably the control's /// container.)
return System

RepeaterTester() public method

Create a tester for a top-level control. Use this constructor for testing most controls. Testers created with this constructor will test pages loaded by the HttpClient.Default HttpClient.

public RepeaterTester ( string aspId, bool hasHeaderTemplate, bool hasSeparatorTemplate, bool hasFooterTemplateContainingServerControl ) : System
aspId string The ID of the control to test (look in the /// page's ASP.NET source code for the ID).
hasHeaderTemplate bool "True" if the repeater being tested has /// a HeaderTemplate.
hasSeparatorTemplate bool "True" if the repeater being tested /// has a SeparatorTemplate.
hasFooterTemplateContainingServerControl bool Read carefully! Set this parameter to /// "True" only if the repeater has a FooterTemplate and /// the FooterTemplate contains a server control--that is, a tag with the 'runat="server"' /// attribute. If you do not, your tests may fail.
return System

RepeaterTester() public method

Create a tester for a nested control. Use this constructor when the control you are testing is nested within another control, such as a DataGrid or UserControl. You should also use this constructor when you're not using the HttpClient.Default HttpClient. NOTE: This constructor assumes that the repeater being tested ONLY has ItemTemplates. If it has a SeparatorTemplate or any other template, use a different constructor.
public RepeaterTester ( string aspId, bool hasHeaderTemplate, bool hasSeparatorTemplate, bool hasFooterTemplateContainingServerControl, Tester container ) : System
aspId string The ID of the control to test (look in the /// page's ASP.NET source code for the ID).
hasHeaderTemplate bool "True" if the repeater being tested has /// a HeaderTemplate.
hasSeparatorTemplate bool "True" if the repeater being tested /// has a SeparatorTemplate.
hasFooterTemplateContainingServerControl bool Read carefully! Set this parameter to /// "True" only if the repeater has a FooterTemplate and /// the FooterTemplate contains a server control--that is, a tag with the 'runat="server"' /// attribute. If you do not, your tests may fail.
container Tester A tester for the control's container. /// (In the page's ASP.NET source code, look for the tag that the /// control is nested in. That's probably the control's /// container.)
return System

Separator() public method

Returns a container for testing controls within the repeater's SeparatorTemplate. The 'separatorNum' is the separator to look for. separatorNum zero is the first separator (between the first and second items); separatorNum one is the second separator (between the second and third items); etc. This method will NOT check to see if the repeater is visible or if it has a SeparatorTemplate. Instead, you'll get a NotVisibleException when you attempt to use the tester instantiated with the result of this method.
public Separator ( int separatorNum ) : RepeaterSeparatorTester
separatorNum int The separator to get (zero-based)
return RepeaterSeparatorTester