private void button1_Click(object sender, EventArgs e) { int i = int.Parse(myLabel.Text) + 1; myLabel.Text = i.ToString(); MultiForm newForm = new MultiForm(); newForm.Name = Name + "-" + (i - 1); newForm.Text = newForm.Name; newForm.Show(); }
public void TestMultipleFormsShouldNotFindLastButton() { MultiForm form = new MultiForm(); form.Show(); ButtonTester buttonOne = new ButtonTester("myButton", "Form"); ButtonTester buttonTwo = new ButtonTester("myButton", "Form-0"); ButtonTester buttonThree = new ButtonTester("myButton", "Form-0-0"); ButtonTester buttonFour = new ButtonTester("myButton", "Form-1"); buttonOne.Click(); buttonTwo.Click(); buttonThree.Click(); buttonFour.Click(); }
public void Close() { using (MultiForm formMultiForm = new MultiForm()) { formMultiForm.Show(); ButtonTester myButton = new ButtonTester("myButton"); using (FormTester form = new FormTester("Form")) { Assert.IsTrue(myButton.Properties.Visible); form.Close(); try { bool shouldNotGetMe = myButton.Properties.Visible; Assert.Fail("found control after closing form"); } catch (NoSuchControlException) { } } } }