Example #1
0
        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();
            Assert.Throws <NoSuchControlException>(() => buttonFour.Click());
        }
Example #4
0
        public void Close()
        {
            using (MultiForm formMultiForm = new MultiForm())
            {
                formMultiForm.Show();
                ButtonTester myButton = new ButtonTester("myButton");
                using (FormTester form = new FormTester("Form"))
                {
                    Assert.True(myButton.Properties.Visible);
                    form.Close();

                    Assert.Throws<NoSuchControlException>(delegate {
                        bool shouldNotGetMe = myButton.Properties.Visible;
                    });
                }
            }
        }
Example #5
0
        public void Close()
        {
            using (MultiForm formMultiForm = new MultiForm())
            {
                formMultiForm.Show();
                ButtonTester myButton = new ButtonTester("myButton");
                using (FormTester form = new FormTester("Form"))
                {
                    Assert.True(myButton.Properties.Visible);
                    form.Close();

                    Assert.Throws <NoSuchControlException>(delegate {
                        bool shouldNotGetMe = myButton.Properties.Visible;
                    });
                }
            }
        }
        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 EventCausesAnother()
        {
            MultiForm form = new MultiForm();
            form.Show();
            TestWriter writer = new TestWriter(form);
            ButtonTester button = new ButtonTester("btnClose");
            button.Click();
            Assert.Throws<NoSuchControlException>(() => button.Click());

            Assert.Equal(
                @"[Fact]
            public void Test()
            {

            ButtonTester btnClose = new ButtonTester(""btnClose"");

            btnClose.Click();

            }",
                writer.Test);
        }
        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.Equal(
                @"[Fact]
            public void Test()
            {

            ButtonTester myButton = new ButtonTester(""myButton"");
            FormTester Form-0 = new FormTester(""Form-0"");

            myButton.Click();
            Form-0.Close();

            }",
                writer.Test);
        }
        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();
            Assert.Throws<NoSuchControlException>(() => buttonFour.Click());
        }
        public void MultipleForms()
        {
            MultiForm form = new MultiForm();
            form.Show();
            TestWriter writer = new TestWriter(form);
            Assert.Equal("", writer.Test);

            ButtonTester button = new ButtonTester("myButton");
            button.Click();
            ButtonTester button2 = new ButtonTester("myButton", "Form-0");
            button2.Click();

            Assert.Equal(
                @"[Fact]
            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);
        }
        public void NamesShouldAdapt()
        {
            MultiForm form = new MultiForm();
            form.Show();
            TestWriter writer = new TestWriter(form);
            Assert.Equal("", writer.Test);

            ButtonTester nothingButton = new ButtonTester("nothingButton");
            nothingButton.Click();

            //------------------------------------------------------

            Assert.Equal(
                @"[Fact]
            public void Test()
            {

            ButtonTester nothingButton = new ButtonTester(""nothingButton"");

            nothingButton.Click();

            }",
                writer.Test);

            //------------------------------------------------------

            ButtonTester myButton = new ButtonTester("myButton");
            myButton.Click();

            //------------------------------------------------------

            Assert.Equal(
                @"[Fact]
            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.Equal(
                @"[Fact]
            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);
            //------------------------------------------------------
        }
Example #12
0
        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();
        }