2 // System.ComponentModel.ToolboxItemAttribute test cases
5 // Gert Driesen (drieseng@users.sourceforge.net)
10 using System.ComponentModel;
12 using NUnit.Framework;
14 namespace MonoTests.System.ComponentModel
17 public class ToolboxItemAttributeTests
22 [Ignore ("TD BUG ID: 7215, 7216")]
24 public void DefaultType ()
26 ToolboxItemAttribute attr = new ToolboxItemAttribute (true);
28 Type toolboxItemType = typeof(global::System.Drawing.Design.ToolboxItem);
30 Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, attr.ToolboxItemTypeName, "#1");
31 Assert.AreEqual (toolboxItemType, attr.ToolboxItemType, "#2");
32 Assert.AreEqual (true, attr.IsDefaultAttribute (), "#3");
33 Assert.AreEqual (attr.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");
35 Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, ToolboxItemAttribute.Default.ToolboxItemTypeName, "#5");
36 Assert.AreEqual (toolboxItemType, ToolboxItemAttribute.Default.ToolboxItemType, "#2");
37 Assert.AreEqual (true, ToolboxItemAttribute.Default.IsDefaultAttribute (), "#3");
38 Assert.AreEqual (ToolboxItemAttribute.Default.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");
42 public void NonDefaultType ()
44 ToolboxItemAttribute attr = new ToolboxItemAttribute (false);
45 Assert.AreEqual (string.Empty, attr.ToolboxItemTypeName, "#1");
46 Assert.IsNull (attr.ToolboxItemType, "#2");
47 Assert.AreEqual (false, attr.IsDefaultAttribute (), "#3");
49 Assert.AreEqual (string.Empty, ToolboxItemAttribute.None.ToolboxItemTypeName, "#4");
50 Assert.IsNull (ToolboxItemAttribute.None.ToolboxItemType, "#5");
51 Assert.AreEqual (false, ToolboxItemAttribute.None.IsDefaultAttribute (), "#6");
55 [ExpectedException (typeof (ArgumentException))]
56 public void InvalidItemTypeName ()
58 ToolboxItemAttribute attr = new ToolboxItemAttribute ("typedoesnotexist");
59 // this next statement should fail
60 Type type = attr.ToolboxItemType;