ApplicationTest.cs 796 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // ApplicationContextTest.cs
  3. //
  4. // Author:
  5. // Chris Toshok ([email protected])
  6. //
  7. // (C) 2006 Novell, Inc. (http://www.novell.com)
  8. //
  9. using System;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. using System.Drawing;
  13. using System.Reflection;
  14. using NUnit.Framework;
  15. namespace MonoTests.System.Windows.Forms
  16. {
  17. [TestFixture]
  18. public class ApplicationTest
  19. {
  20. ApplicationContext ctx;
  21. void form_visible_changed (object sender, EventArgs e)
  22. {
  23. Assert.AreEqual (sender, ctx.MainForm, "1");
  24. ((Form)sender).Close();
  25. }
  26. [Test]
  27. public void ContextMainFormTest ()
  28. {
  29. Form f1 = new Form ();
  30. ctx = new ApplicationContext (f1);
  31. f1.VisibleChanged += new EventHandler (form_visible_changed);
  32. Application.Run (ctx);
  33. Assert.IsNull (ctx.MainForm, "2");
  34. }
  35. }
  36. }