We Recommend

Accelerated C# 2008 Accelerated C# 2008
This book is both a rapid tutorial and a permanent reference. You’ll quickly master C# syntax while learning how the CLR simplifies many programming tasks. You’ll also learn best practices that ensure your code will be efficient, reusable, and robust. Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start?


Posted By

rengber on 04/12/07


Tagged

TDD NUnit NUnitForms WinForms


Versions (?)


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.