IsDefaultAttribute() public method

public IsDefaultAttribute ( ) : bool
return bool
Example #1
0
        public void Ctor_Type(Type toolboxItemType)
        {
            var attribute = new ToolboxItemAttribute(toolboxItemType);

            Assert.Equal(toolboxItemType.AssemblyQualifiedName, attribute.ToolboxItemTypeName);
            Assert.Same(toolboxItemType, attribute.ToolboxItemType);
            Assert.False(attribute.IsDefaultAttribute());
        }
Example #2
0
        public void None_Get_ReturnsExpected()
        {
            ToolboxItemAttribute attribute = ToolboxItemAttribute.None;

            Assert.Same(attribute, ToolboxItemAttribute.None);
            Assert.Empty(attribute.ToolboxItemTypeName);
            Assert.Null(attribute.ToolboxItemType);
            Assert.False(attribute.IsDefaultAttribute());
        }
Example #3
0
        public void Default_Get_ReturnsExpected()
        {
            ToolboxItemAttribute attribute = ToolboxItemAttribute.Default;

            Assert.Same(attribute, ToolboxItemAttribute.Default);
            Assert.Equal("System.Drawing.Design.ToolboxItem, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", attribute.ToolboxItemTypeName);
            AssertExtensions.Throws <ArgumentException>(null, () => attribute.ToolboxItemType);
            Assert.True(attribute.IsDefaultAttribute());
        }
		public void NonDefaultType ()
		{
			ToolboxItemAttribute attr = new ToolboxItemAttribute (false);
			Assert.AreEqual (string.Empty, attr.ToolboxItemTypeName, "#1");
			Assert.IsNull (attr.ToolboxItemType, "#2");
			Assert.AreEqual (false, attr.IsDefaultAttribute (), "#3");

			Assert.AreEqual (string.Empty, ToolboxItemAttribute.None.ToolboxItemTypeName, "#4");
			Assert.IsNull (ToolboxItemAttribute.None.ToolboxItemType, "#5");
			Assert.AreEqual (false, ToolboxItemAttribute.None.IsDefaultAttribute (), "#6");
		}
		public void DefaultType ()
		{
			ToolboxItemAttribute attr = new ToolboxItemAttribute (true);
			
			Type toolboxItemType = typeof(global::System.Drawing.Design.ToolboxItem);

			Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, attr.ToolboxItemTypeName, "#1");
			Assert.AreEqual (toolboxItemType, attr.ToolboxItemType, "#2");
			Assert.AreEqual (true, attr.IsDefaultAttribute (), "#3");
			Assert.AreEqual (attr.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");

			Assert.AreEqual (toolboxItemType.AssemblyQualifiedName, ToolboxItemAttribute.Default.ToolboxItemTypeName, "#5");
			Assert.AreEqual (toolboxItemType, ToolboxItemAttribute.Default.ToolboxItemType, "#2");
			Assert.AreEqual (true, ToolboxItemAttribute.Default.IsDefaultAttribute (), "#3");
			Assert.AreEqual (ToolboxItemAttribute.Default.ToolboxItemTypeName.GetHashCode (), attr.GetHashCode (), "#4");
		}
Example #6
0
        public void Ctor_Bool(bool defaultType)
        {
            var attribute = new ToolboxItemAttribute(defaultType);

            if (defaultType)
            {
                Assert.Equal("System.Drawing.Design.ToolboxItem, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", attribute.ToolboxItemTypeName);
                AssertExtensions.Throws <ArgumentException>(null, () => attribute.ToolboxItemType);
            }
            else
            {
                Assert.Empty(attribute.ToolboxItemTypeName);
                Assert.Null(attribute.ToolboxItemType);
            }
            Assert.Equal(defaultType, attribute.IsDefaultAttribute());
        }
Example #7
0
        public void Ctor_String(string toolboxItemTypeName, bool expectedIsDefault)
        {
            var attribute = new ToolboxItemAttribute(toolboxItemTypeName);

            Assert.Equal(toolboxItemTypeName, attribute.ToolboxItemTypeName);

            Type expectedType = Type.GetType(toolboxItemTypeName);

            if (expectedType != null)
            {
                Assert.Equal(expectedType, attribute.ToolboxItemType);
                Assert.Same(attribute.ToolboxItemType, attribute.ToolboxItemType);
            }
            else
            {
                AssertExtensions.Throws <ArgumentException>(null, () => attribute.ToolboxItemType);
            }
            Assert.Equal(expectedIsDefault, attribute.IsDefaultAttribute());
        }