If the aspx.cs was inherited from System.Web.UI.Page,
everything was right.
But if the aspx.cs was inherited from class PageBase
that inherited from System.Web.UI.Page, i got error:
---------------------
UnitTest.Web.mypageTest.TestAdd : page form elements
expected:<1>
but was:<0>
---------------------
using System;
using System.Web;
namespace myWeb
{
public class PageBase : System.Web.UI.Page
{
public PageBase()
{
}
protected override void OnLoad
(EventArgs e)
{
if (!Users.IsLogin())
{
Go2Login();
}
string cssLink = "<link
href=\"css\\main.css\" type=\"text/css\"
rel=\"stylesheet\">\n";
Response.Write(cssLink);
base.OnLoad(e);
}
private void Go2Login()
{
string strScript = "";
strScript += "<script
language=\"javascript\">\n";
strScript += "confirm(\"please
login\");\n";
strScript
+= "top.location.href = \"login.aspx\";\n";
strScript += "</script>";
Response.Write(strScript);
Response.End();
}
}
}