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