Skip to content

Instantly share code, notes, and snippets.

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