NUnitAsp

AspControlTester Constructor (String, Tester)

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 Default HttpClient.

public AspControlTester(
   string aspId,
   Tester container
);

Parameters

aspId
The ID of the control to test (look in the page's ASP.NET source code for the ID).
container
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.)

Example

This example demonstrates how to test a label that's inside of a user control:

            UserControlTester user1 = new UserControlTester("user1");
            LabelTester label = new LabelTester("label", user1);
This example demonstrates how to use an HttpClient other than Default:
            HttpClient myHttpClient = new HttpClient();
            WebForm currentWebForm = new WebForm(myHttpClient);
            LabelTester myTester = new LabelTester("id", currentWebForm);

See Also

AspControlTester Class | NUnit.Extensions.Asp.AspTester Namespace | AspControlTester Constructor Overload List