Ejemplo n.º 1
0
        public void Verify()
        {
            TearDown();

            if (!verified)
            {
                verified = true;
                List <Form> allForms = new FormFinder().FindAll();

                foreach (Form form in allForms)
                {
                    if (!KeepAlive.ShouldKeepAlive(form))
                    {
                        form.Dispose();
                        form.Hide();
                    }
                }

                string[] errors      = new string[0];
                bool     modalVerify = modal.Verify();
                if (!modalVerify)
                {
                    errors = modal.GetErrors();
                }
                modal.Dispose();

                if (UseHidden)
                {
                    testDesktop.Dispose();
                }

                mouse.Dispose();
                keyboard.Dispose();

                if (!modalVerify)
                {
                    string message = "";
                    foreach (string m in errors)
                    {
                        message += m + ((errors.Length > 1) ? "\r\n" : "");
                    }
                    throw new FormsTestAssertionException(message);
                }
            }
        }
Ejemplo n.º 2
0
        public void Verify()
        {
            TearDown();

            if (!verified)
            {
                verified = true;
                FormCollection allForms = new FormFinder().FindAll();

                foreach (Form form in allForms)
                {
                    if (!KeepAlive(form))
                    {
                        form.Dispose();
                        form.Hide();
                    } //else branch not tested
                }

                bool modalVerify = modal.Verify();

                modal.Dispose();

                if (UseHidden)
                {
                    testDesktop.Dispose();
                }

                mouse.Dispose();
                keyboard.Dispose();

                if (!modalVerify)
                {
                    throw new FormsTestAssertionException("unexpected/expected modal was invoked/not invoked");
                }
            }
        }
Ejemplo n.º 3
0
        public void Verify()
        {
            try
            {
                TearDown();
                Util.GetMessageHook.RemoveHook();

                if (ModalFormHandler == null)
                {
                    // Make an effort to ensure that no window message is left dangling
                    // Such a message might cause an unexpected dialog box
                    for (int i = 0; i < 10; ++i)
                    {
                        Application.DoEvents();
                    }
                }

                if (!verified)
                {
                    verified = true;
                    List <Form> allForms = new FormFinder().FindAll();

                    foreach (Form form in allForms)
                    {
                        if (!KeepAlive.ShouldKeepAlive(form))
                        {
                            form.Dispose();
                            form.Hide();
                        }
                    }

                    string[] errors = new string[0];
                    ModalFormTester.Result modalResult = modal.Verify();
                    if (!modalResult.AllModalsShown)
                    {
                        throw new FormsTestAssertionException("Expected Modal Form did not show");
                    }
                    if (modalResult.UnexpectedModalWasShown)
                    {
                        string msg = "Unexpected modals: ";
                        foreach (string mod in modalResult.UnexpectedModals)
                        {
                            msg += mod + ", ";
                        }
                        throw new FormsTestAssertionException(msg);
                    }

                    modal.Dispose();

                    if (UseHidden)
                    {
                        testDesktop.Dispose();
                    }
                }
            }
            finally
            {
                modal.Dispose();
                mouse.Dispose();
                keyboard.Dispose();
            }
        }