public void Ctor_AllowMerge(bool allowMerge)
        {
            var attribute = new MergablePropertyAttribute(allowMerge);

            Assert.Equal(allowMerge, attribute.AllowMerge);
            Assert.Equal(allowMerge, attribute.IsDefaultAttribute());
        }
 public void Equals_Object_ReturnsExpected(MergablePropertyAttribute attribute, object other, bool expected)
 {
     Assert.Equal(expected, attribute.Equals(other));
     if (other is MergablePropertyAttribute)
     {
         Assert.Equal(expected, attribute.GetHashCode().Equals(other.GetHashCode()));
     }
 }
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            MergablePropertyAttribute other = obj as MergablePropertyAttribute;

            return(other?.AllowMerge == AllowMerge);
        }
Beispiel #4
0
        // Determine if two objects are equal.
        public override bool Equals(Object obj)
        {
            MergablePropertyAttribute other =
                (obj as MergablePropertyAttribute);

            if (other != null)
            {
                return(allowMerge == other.allowMerge);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        private bool IsPropertyMergeable(PropertyDescriptor property)
        {
            if (property == null)
            {
                return(false);
            }

            MergablePropertyAttribute attrib = property.Attributes [typeof(MergablePropertyAttribute)] as MergablePropertyAttribute;

            if (attrib != null && !attrib.AllowMerge)
            {
                return(false);
            }

            return(true);
        }
Beispiel #6
0
    protected void Method()
    {
// <Snippet1>
        // Gets the attributes for the property.
        AttributeCollection attributes =
            TypeDescriptor.GetProperties(this)["MyPropertyProperty"].Attributes;

        // Checks to see if the property is bindable.
        MergablePropertyAttribute myAttribute = (MergablePropertyAttribute)attributes[typeof(MergablePropertyAttribute)];

        if (myAttribute.AllowMerge)
        {
            // Insert code here.
        }

// </Snippet1>
    }
Beispiel #7
0
 public void NameTests(MergablePropertyAttribute attribute, bool isMergable)
 {
     Assert.Equal(isMergable, attribute.AllowMerge);
 }
Beispiel #8
0
        public void GetAllowMerge(bool value)
        {
            var attribute = new MergablePropertyAttribute(value);

            Assert.Equal(value, attribute.AllowMerge);
        }
 public void NameTests(MergablePropertyAttribute attribute, bool isMergable)
 {
     Assert.Equal(isMergable, attribute.AllowMerge);
 }
        public void GetAllowMerge(bool value)
        {
            var attribute = new MergablePropertyAttribute(value);

            Assert.Equal(value, attribute.AllowMerge);
        }
 public void DefaultProperties_GetAllowMerge_ReturnsExpected(MergablePropertyAttribute attribute, bool expectedAllowMerge)
 {
     Assert.Equal(expectedAllowMerge, attribute.AllowMerge);
     Assert.Equal(expectedAllowMerge, attribute.IsDefaultAttribute());
 }