Mono BCL test fixes so XM can run them (#4210)
[mono-project.git] / mcs / class / System / Test / System.ComponentModel / ToolboxItemAttributeTests.cs
blob8707702ce0ec0276e14ddf4fefc927fbf40d2ccd
1 //
2 // System.ComponentModel.ToolboxItemAttribute test cases
3 //
4 // Authors:
5 // Gert Driesen (drieseng@users.sourceforge.net)
6 //
7 // (c) 2005 Novell
9 using System;
10 using System.ComponentModel;
12 using NUnit.Framework;
14 namespace MonoTests.System.ComponentModel
16 [TestFixture]
17 public class ToolboxItemAttributeTests
19 #if !MOBILE && !MONOMAC
20 [Test]
21 public void DefaultType ()
23 ToolboxItemAttribute attr = new ToolboxItemAttribute (true);
25 Type toolboxItemType = typeof(global::System.Drawing.Design.ToolboxItem);
27 Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, attr.ToolboxItemTypeName, "#1");
28 Assert.AreEqual (toolboxItemType, attr.ToolboxItemType, "#2");
29 Assert.AreEqual (true, attr.IsDefaultAttribute (), "#3");
30 Assert.AreEqual (attr.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");
32 Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, ToolboxItemAttribute.Default.ToolboxItemTypeName, "#5");
33 Assert.AreEqual (toolboxItemType, ToolboxItemAttribute.Default.ToolboxItemType, "#2");
34 Assert.AreEqual (true, ToolboxItemAttribute.Default.IsDefaultAttribute (), "#3");
35 Assert.AreEqual (ToolboxItemAttribute.Default.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");
37 #endif
38 [Test]
39 public void NonDefaultType ()
41 ToolboxItemAttribute attr = new ToolboxItemAttribute (false);
42 Assert.AreEqual (string.Empty, attr.ToolboxItemTypeName, "#1");
43 Assert.IsNull (attr.ToolboxItemType, "#2");
44 Assert.AreEqual (false, attr.IsDefaultAttribute (), "#3");
46 Assert.AreEqual (string.Empty, ToolboxItemAttribute.None.ToolboxItemTypeName, "#4");
47 Assert.IsNull (ToolboxItemAttribute.None.ToolboxItemType, "#5");
48 Assert.AreEqual (false, ToolboxItemAttribute.None.IsDefaultAttribute (), "#6");
51 [Test]
52 [ExpectedException (typeof (ArgumentException))]
53 public void InvalidItemTypeName ()
55 ToolboxItemAttribute attr = new ToolboxItemAttribute ("typedoesnotexist");
56 // this next statement should fail
57 Type type = attr.ToolboxItemType;