Posted By

rengber on 04/12/07


Tagged

TDD NUnit NUnitForms WinForms


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


NUnit Forms Code to Dismiss a Modal Form (not a messagebox).


 / Published in: C#
 

The trick to this is that you must find the class name of the form. The caption won't cut it for non-messagebox modals.

  1. [Test]
  2. public void SendTransaction()
  3. {
  4. FormTester ft = LaunchForm();
  5. FillFormDetails(ft);
  6. ButtonTester bt = new ButtonTester("cmdApply", ft.Properties);
  7. ExpectModal("UpdateInfo","CloseUpdateWindow");
  8. bt.Click();
  9. }
  10.  
  11. private void CloseUpdateWindow()
  12. {
  13. FormTester ft = new FormTester("UpdateInfo");
  14. Assert.IsTrue(ft.Text == "Updated successfully");
  15. ft.Close();
  16. }

Report this snippet  

You need to login to post a comment.