示例#1
0
        public void OpenTest_ConfidenceOnManyOpens()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();

            f.Show();
            for (int count = 0; count < 1000; count++)
            {
                //PROBLEM
                // This test runs most of the time.
                // Every now and then it will leave an open file dialog on display as though the handler has not been run.
                // When this happens, switching focus away from it then back to it allows the handler to run,
                // but fails the test when checking the number of invocations.

                //SOLUTION

                /* The 'SetDlgItemText' function in the 'FileDialogTester.cs' file did not set the text
                 * in the dialog box occassionaly. The solution was to set the text twice on the dialog box.
                 * The code below was run upto 1000 times to check that the solution works.
                 */

                LabelTester label1 = new LabelTester("lblFileName");
                ModalFormHandler = OpenFileHandler;
                string       fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XunitForms.dll");
                ButtonTester open_btn = new ButtonTester("btOpenFile");
                open_btn.Click();

                Assert.Equal(label1.Text.ToLowerInvariant(), fileName.ToLowerInvariant());
            }
            f.Close();
        }
示例#2
0
        public void OpenTest()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();

            f.Show();
            LabelTester label1 = new LabelTester("lblFileName");

            ModalFormHandler = OpenFileHandler;
            string       fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XunitForms.dll");
            ButtonTester open_btn = new ButtonTester("btOpenFile");

            open_btn.Click();

            Assert.Equal(label1.Text.ToLower(), fileName.ToLower());
            f.Close();
        }
        public void CancelTest()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();
            f.Show();

            LabelTester label1 = new LabelTester("lblFileName");
            ButtonTester open_btn = new ButtonTester("btOpenFile");
            ModalFormHandler = CancelFileHandler;
            System.Windows.Forms.Application.DoEvents();
            open_btn.Click();
            System.Windows.Forms.Application.DoEvents();

            Assert.Equal(label1.Text, "cancel pressed");

            f.Close();
        }
示例#4
0
        public void CancelTest()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();

            f.Show();

            LabelTester  label1   = new LabelTester("lblFileName");
            ButtonTester open_btn = new ButtonTester("btOpenFile");

            ModalFormHandler = CancelFileHandler;
            System.Windows.Forms.Application.DoEvents();
            open_btn.Click();
            System.Windows.Forms.Application.DoEvents();


            Assert.Equal(label1.Text, "cancel pressed");

            f.Close();
        }
        public void OpenTest()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();
            f.Show();
            LabelTester label1 = new LabelTester("lblFileName");
            ModalFormHandler = OpenFileHandler;
            string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XunitForms.dll");
            ButtonTester open_btn = new ButtonTester("btOpenFile");
            open_btn.Click();

            Assert.Equal(label1.Text.ToLower(), fileName.ToLower());
            f.Close();
        }
        public void OpenTest_ConfidenceOnManyOpens()
        {
            OpenFileDialogTestForm f = new OpenFileDialogTestForm();
            f.Show();
            for (int count = 0; count < 1000; count++)
            {
                //PROBLEM
                // This test runs most of the time.
                // Every now and then it will leave an open file dialog on display as though the handler has not been run.
                // When this happens, switching focus away from it then back to it allows the handler to run,
                // but fails the test when checking the number of invocations.

                //SOLUTION
                /* The 'SetDlgItemText' function in the 'FileDialogTester.cs' file did not set the text
                 * in the dialog box occassionaly. The solution was to set the text twice on the dialog box.
                 * The code below was run upto 1000 times to check that the solution works.
                 */

                LabelTester label1 = new LabelTester("lblFileName");
                ModalFormHandler = OpenFileHandler;
                string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XunitForms.dll");
                ButtonTester open_btn = new ButtonTester("btOpenFile");
                open_btn.Click();

                Assert.Equal(label1.Text.ToLowerInvariant(), fileName.ToLowerInvariant());
            }
            f.Close();
        }