Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created April 4, 2013 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adilakhter/5311072 to your computer and use it in GitHub Desktop.
Save adilakhter/5311072 to your computer and use it in GitHub Desktop.
[TestMethod]
[HostType("Asp.Net")]
[UrlToTest("http://localhost/ourwebapplication")]
public void TestMethod(){
Page page = TestContext.RequestedPage;
PrivateObject privateObject = new PrivateObject(page);
Button button = (Button)page.FindControl("Button1");
privateObject.Invoke("Button1_Click", button, EventArgs.Empty);
Label label = (Label)page.FindControl("Label1");
Assert.AreEqual<string>("Hello World !!!!", label.Text);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment