Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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