AssertEquals (typeof(TypeConverter), TypeDescriptor.GetConverter (new TestClass ()).GetType());
AssertEquals (typeof(TypeConverter), TypeDescriptor.GetConverter (new TestStruct ()).GetType());
AssertEquals (typeof(CollectionConverter), TypeDescriptor.GetConverter (new Hashtable ()).GetType());
+
+#if NET_2_0
+ // Test from bug #76686
+ AssertEquals (typeof (Int32Converter), TypeDescriptor.GetConverter ((int?) 1).GetType ());
+#endif
}
[Test]
TestConverter converter = (TestConverter) t;
AssertEquals ("#03", typeof (TestConverterClass), converter.Type);
}
+
+ [Test]
+ public void GetPropertiesIgnoreIndexers ()
+ {
+ PropertyDescriptorCollection pc =
+ TypeDescriptor.GetProperties (typeof (string));
+ // There are two string properties: Length and Chars.
+ // Chars is an indexer.
+ //
+ // Future version of CLI might contain some additional
+ // properties. In that case simply increase the
+ // number. (Also, it is fine to just remove #2.)
+ AssertEquals ("#1", 1, pc.Count);
+ AssertEquals ("#2", "Length", pc [0].Name);
+ }
}
}