Bladeren bron

Application unit tests

svn path=/trunk/mcs/; revision=67969
Chris Toshok 19 jaren geleden
bovenliggende
commit
87b92eec8b
1 gewijzigde bestanden met toevoegingen van 43 en 0 verwijderingen
  1. 43 0
      mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ApplicationTest.cs

+ 43 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ApplicationTest.cs

@@ -0,0 +1,43 @@
+//
+// ApplicationContextTest.cs
+//
+// Author:
+//   Chris Toshok ([email protected])
+//
+// (C) 2006 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ApplicationTest
+	{
+		ApplicationContext ctx;
+
+		void form_visible_changed (object sender, EventArgs e)
+		{
+			Assert.AreEqual (sender, ctx.MainForm, "1");
+			((Form)sender).Close();
+		}
+
+		[Test]
+		public void ContextMainFormTest ()
+		{
+			Form f1 = new Form ();
+			ctx = new ApplicationContext (f1);
+
+			f1.VisibleChanged += new EventHandler (form_visible_changed);
+
+			Application.Run (ctx);
+
+			Assert.IsNull (ctx.MainForm, "2");
+		}
+	}
+}