CheckedListBoxEventTest.cs 842 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // Copyright (c) 2005 Novell, Inc.
  3. //
  4. // Authors:
  5. // Ritvik Mayank ([email protected])
  6. //
  7. using System;
  8. using NUnit.Framework;
  9. using System.Windows.Forms;
  10. using System.Drawing;
  11. namespace MonoTests.System.Windows.Forms
  12. {
  13. [TestFixture]
  14. public class CheckedListBoxItemCheckEvent
  15. {
  16. static bool eventhandled = false;
  17. public void ItemCheck_EventHandler (object sender,ItemCheckEventArgs e)
  18. {
  19. eventhandled = true;
  20. }
  21. [Test]
  22. public void ItemCheckTest ()
  23. {
  24. Form myform = new Form ();
  25. CheckedListBox mychklstbox = new CheckedListBox ();
  26. //Test ItemCheck Event
  27. mychklstbox.ItemCheck += new ItemCheckEventHandler (ItemCheck_EventHandler);
  28. mychklstbox.Items.Add ("test1",CheckState.Checked);
  29. myform.Controls.Add (mychklstbox);
  30. myform.Show ();
  31. Assert.AreEqual (true, eventhandled, "#A1");
  32. }
  33. }
  34. }