/// <summary> /// This method is called by Xunit after each test runs. If you have custom /// behavior to run after each test, then override the TearDown method and do /// it there. That method is called at the beginning of this one. /// You should not need to do anything with it. Do not call it. /// If you do call it, call it as the last thing you do in your test. /// </summary> 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(); } }