2 // ApplicationContextTest.cs
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2006 Novell, Inc. (http://www.novell.com)
11 using System.ComponentModel;
12 using System.Windows.Forms;
14 using System.Reflection;
15 using NUnit.Framework;
17 namespace MonoTests.System.Windows.Forms
20 public class ApplicationTest
22 ApplicationContext ctx;
24 void form_visible_changed (object sender, EventArgs e)
26 Assert.AreEqual (sender, ctx.MainForm, "1");
27 ((Form)sender).Close();
31 public void ContextMainFormTest ()
33 Form f1 = new Form ();
34 ctx = new ApplicationContext (f1);
36 f1.VisibleChanged += new EventHandler (form_visible_changed);
38 Application.Run (ctx);
40 Assert.IsNull (ctx.MainForm, "2");
44 [ExpectedException (typeof (NotSupportedException))]
45 public void RestartNotSupportedExceptionTest ()
47 Application.Restart ();