public void EventCausesAnother() { MultiForm form = new MultiForm(); form.Show(); TestWriter writer = new TestWriter(form); ButtonTester button = new ButtonTester("btnClose"); button.Click(); try { button.Click(); Assert.Fail("Window did not close."); } catch(NoSuchControlException) { //window is closed.. good. } Assert.AreEqual( @"[Test] public void Test() { ButtonTester btnClose = new ButtonTester(""btnClose""); btnClose.Click(); }", writer.Test); }
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 TestMultipleForms() { 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(); buttonOne.Click(); buttonFour.Click(); }
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) {} } } }
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) {} } } }
public void FormClose() { MultiForm form = new MultiForm(); form.Show(); TestWriter writer = new TestWriter(form); ButtonTester button = new ButtonTester("myButton"); button.Click(); FormTester form0 = new FormTester("Form-0"); form0.Close(); Assert.AreEqual( @"[Test] public void Test() { ButtonTester myButton = new ButtonTester(""myButton""); FormTester Form-0 = new FormTester(""Form-0""); myButton.Click(); Form-0.Close(); }", writer.Test); }
public void NamesShouldAdapt() { MultiForm form = new MultiForm(); form.Show(); TestWriter writer = new TestWriter(form); Assert.AreEqual("", writer.Test); ButtonTester nothingButton = new ButtonTester("nothingButton"); nothingButton.Click(); //------------------------------------------------------ Assert.AreEqual( @"[Test] public void Test() { ButtonTester nothingButton = new ButtonTester(""nothingButton""); nothingButton.Click(); }", writer.Test); //------------------------------------------------------ ButtonTester myButton = new ButtonTester("myButton"); myButton.Click(); //------------------------------------------------------ Assert.AreEqual( @"[Test] public void Test() { ButtonTester nothingButton = new ButtonTester(""nothingButton""); ButtonTester myButton = new ButtonTester(""myButton""); nothingButton.Click(); myButton.Click(); }", writer.Test); //------------------------------------------------------ ButtonTester nothingButton2 = new ButtonTester("nothingButton", "Form-0"); nothingButton2.Click(); ButtonTester nothingButton3 = new ButtonTester("nothingButton", "Form"); nothingButton3.Click(); //------------------------------------------------------ Assert.AreEqual( @"[Test] public void Test() { ButtonTester Form_nothingButton = new ButtonTester(""nothingButton"", ""Form""); ButtonTester myButton = new ButtonTester(""myButton""); ButtonTester Form-0_nothingButton = new ButtonTester(""nothingButton"", ""Form-0""); Form_nothingButton.Click(); myButton.Click(); Form-0_nothingButton.Click(); Form_nothingButton.Click(); }", writer.Test); //------------------------------------------------------ }
public void MultipleForms() { MultiForm form = new MultiForm(); form.Show(); TestWriter writer = new TestWriter(form); Assert.AreEqual("", writer.Test); ButtonTester button = new ButtonTester("myButton"); button.Click(); ButtonTester button2 = new ButtonTester("myButton", "Form-0"); button2.Click(); Assert.AreEqual( @"[Test] public void Test() { ButtonTester myButton = new ButtonTester(""myButton""); ButtonTester Form-0_myButton = new ButtonTester(""myButton"", ""Form-0""); myButton.Click(); Form-0_myButton.Click(); }", writer.Test); }
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(); }