ControlBindingsConverterTest.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // Copyright (c) 2006 Novell, Inc.
  3. //
  4. // Authors:
  5. // Chris Toshok ([email protected])
  6. //
  7. using System;
  8. using System.Windows.Forms;
  9. using System.Drawing;
  10. using System.Threading;
  11. using System.ComponentModel;
  12. using System.Runtime.Remoting;
  13. using NUnit.Framework;
  14. namespace MonoTests.System.Windows.Forms.Design
  15. {
  16. [TestFixture]
  17. public class ControlBindingsConverterTest
  18. {
  19. [Test]
  20. [NUnit.Framework.Category ("NotWorking")]
  21. public void TestProperties ()
  22. {
  23. Control c = new Control ();
  24. ControlBindingsCollection col = c.DataBindings;
  25. TypeConverter cvt = TypeDescriptor.GetConverter (col);
  26. Assert.IsNotNull (cvt, "1");
  27. Assert.IsTrue (cvt.GetPropertiesSupported (null), "2");
  28. PropertyDescriptorCollection props = cvt.GetProperties (null, col, null);
  29. Assert.AreEqual (3, props.Count, "3");
  30. Assert.AreEqual ("Tag", props[0].Name, "4");
  31. Console.WriteLine (props[0].GetType());
  32. Console.WriteLine ("tag value = {0}", props[0].GetValue (col));
  33. Console.WriteLine ("tag converter = {0}", props[0].Converter);
  34. Console.WriteLine ("tag localizable = {0}", props[0].IsLocalizable);
  35. Console.WriteLine ("tag readonly = {0}", props[0].IsReadOnly);
  36. Console.WriteLine ("tag type = {0}", props[0].PropertyType);
  37. Console.WriteLine ("tag category = {0}", props[0].Category);
  38. Console.WriteLine ("tag description = {0}", props[0].Description);
  39. Console.WriteLine ("tag displaynem = {0}", props[0].DisplayName);
  40. Console.WriteLine ("tag has {0} attributes", props[0].Attributes.Count);
  41. Assert.AreEqual ("Text", props[1].Name, "5");
  42. Console.WriteLine (props[1].GetType());
  43. Console.WriteLine ("text value = {0}", props[1].GetValue (col));
  44. Console.WriteLine ("text converter = {0}", props[1].Converter);
  45. Console.WriteLine ("text localizable = {0}", props[1].IsLocalizable);
  46. Console.WriteLine ("text readonly = {0}", props[1].IsReadOnly);
  47. Console.WriteLine ("text type = {0}", props[1].PropertyType);
  48. Console.WriteLine ("text category = {0}", props[1].Category);
  49. Console.WriteLine ("text description = {0}", props[1].Description);
  50. Console.WriteLine ("text displaynem = {0}", props[1].DisplayName);
  51. Console.WriteLine ("text has {0} attributes", props[1].Attributes.Count);
  52. Assert.AreEqual ("(Advanced)", props[2].Name, "6");
  53. Console.WriteLine (props[2].GetType());
  54. Console.WriteLine ("advanced value = {0}", props[2].GetValue (col));
  55. TypeConverter propcvt = props[2].Converter;
  56. Console.WriteLine ("advanced converter = {0}", propcvt.GetType());
  57. Console.WriteLine ("");
  58. if (null == propcvt.GetProperties(props[2].GetValue (col)))
  59. Console.WriteLine ("null properties");
  60. else
  61. Console.WriteLine (" {0} properties", propcvt.GetProperties(props[2].GetValue (col)).Count);
  62. Console.WriteLine ("advanced converter = {0}/{1}/{2}",
  63. propcvt.GetPropertiesSupported (),
  64. propcvt.GetStandardValuesSupported (),
  65. propcvt.GetCreateInstanceSupported ());
  66. Console.WriteLine ("advanced localizable = {0}", props[2].IsLocalizable);
  67. Console.WriteLine ("advanced readonly = {0}", props[2].IsReadOnly);
  68. Console.WriteLine ("advanced type = {0}", props[2].PropertyType);
  69. Console.WriteLine ("advanced category = {0}", props[2].Category);
  70. Console.WriteLine ("advanced description = {0}", props[2].Description);
  71. Console.WriteLine ("advanced displaynem = {0}", props[2].DisplayName);
  72. Console.WriteLine ("advanced has {0} attributes", props[2].Attributes.Count);
  73. foreach (Attribute a in props[2].Attributes) {
  74. Console.WriteLine (" attribute = {0}", a);
  75. }
  76. }
  77. }
  78. }