Ejemplo n.º 1
0
        /// <summary>
        /// Returns null if AttributeSpec doesn't exist
        /// </summary>
        /// <param name="attributeName"></param>
        /// <returns></returns>
        public AttributeSpec GetAttributeSpec(string attributeName)
        {
            AttributeSpec attSpec = null;

            if (attributeSpecs.TryGetValue(attributeName, out attSpec))
            {
                return(attSpec);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        protected static void Test <T>(Type placeholder) where T : Attribute
        {
            // Arrange
            var type          = Module.Types.First(f => f.FullName == placeholder.FullName);
            var att           = type.CustomAttributes.FirstOrDefault(at => typeof(T).FullName == at.AttributeType.FullName);
            var dataAttribute = placeholder.GetCustomAttributesData().FirstOrDefault(a => a.AttributeType == typeof(T));
            var data          = new AttributeData <T>(blob: att.GetBlob(), attribute: placeholder.GetCustomAttribute <T>(), dataAttribute);

            // Act
            var result = AttributeSpec.Parse(data.Data.Constructor, data.Blob).Build();

            // Assert
            Assert.True(result.Equals(data.Attribute));
        }
Ejemplo n.º 3
0
        public static AttributeValueWrap Create(AttributeSpec specification, string value = null)
        {
            var specType = specification.GetType();

            if (specType == typeof(AttributeSpecBool))
            {
                return new AttributeValueWrapBool {
                           Code = specification.Code, RawValue = value ?? specification.DefaultValue
                }
            }
            ;
            if (specType == typeof(AttributeSpecInt))
            {
                return new AttributeValueWrapInt {
                           Code = specification.Code, RawValue = value ?? specification.DefaultValue
                }
            }
            ;
            if (specType == typeof(AttributeSpecSelect))
            {
                return new AttributeValueWrapSelect {
                           Code = specification.Code, RawValue = value ?? specification.DefaultValue
                }
            }
            ;
            if (specType == typeof(AttributeSpecText))
            {
                return new AttributeValueWrapText {
                           Code = specification.Code, RawValue = value ?? specification.DefaultValue
                }
            }
            ;
            if (specType == typeof(AttributeSpecDateTime))
            {
                return new AttributeValueWrapDateTime {
                           Code = specification.Code, RawValue = value ?? specification.DefaultValue
                }
            }
            ;

            return(null);
        }
Ejemplo n.º 4
0
 private void FireEvent(AttributeSpec obj, AttributeSpecEventArgs args)
 {
     AttributeSpecChangeEvent(obj, args);
 }
Ejemplo n.º 5
0
 private void FireEvent(AttributeSpec obj, AttributeSpecEventArgs args)
 {
     AttributeSpecChangeEvent(obj, args);
 }