Beispiel #1
0
        /// <summary>
        /// This method should be called after each test runs.
        /// </summary>
        public void 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 (!modalVerify)
                {
                    throw new FormsTestAssertionException("unexpected/expected modal was invoked/not invoked");
                }
            }
        }
Beispiel #2
0
        private void PaintAllForms()
        {
            FormCollection forms = new FormFinder().FindAll();

            foreach (Form refresh in forms)
            {
                if ((refresh is IKeepAlive) && (((IKeepAlive)refresh).KeepAlive))
                {
                    continue;
                }
                refresh.Invalidate();
                refresh.Focus();
                Application.DoEvents();
            }
        }
Beispiel #3
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);
                }
            }
        }
Beispiel #4
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");
		}
	  }
	}
Beispiel #5
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();
            }
        }
Beispiel #6
0
		private void PaintAllForms()
		{
			FormCollection forms = new FormFinder().FindAll();
			foreach(Form refresh in forms)
			{
				if((refresh is IKeepAlive) && (((IKeepAlive) refresh).KeepAlive))
				{
					continue;
				}
				refresh.Invalidate();
				refresh.Focus();
				Application.DoEvents();
			}
		}