Visual Studio 2008 Professional Edition
Unit Tests
Source
protected void btnNext_Click(object sender, EventArgs e)
{
//Response.Redirect("~/logon.aspx");
lblTest.Text = "This is test";
}
[TestMethod()]
[HostType("ASP.NET")]
[UrlToTest("http://localhost/UnitTestPrj/SampleTestPage.aspx")]
[DeploymentItem("UnitTestPrj.dll")]
public void btnNext_ClickTest()
{
Page page = testContextInstance.RequestedPage;
// TODO: Initialize to an appropriate value
SampleTestPage_Accessor target = new SampleTestPage_Accessor(new PrivateObject(page));
object sender = null;
EventArgs e = null;
target.btnNext_Click(sender, e);
Assert.AreEqual("This is test", target.lblTest.Text);
}