public void TestThatPropertyWithoutMatchingAttributesYieldsNoAttributes()
        {
            var property = typeof(TestClassWithAttributes).GetTypeInfo().GetMember(nameof(TestClassWithAttributes.Foo))[0];

            AttributeUtilities.GetAttributes <ArgumentSetAttribute>(property).Should().BeEmpty();
            AttributeUtilities.GetAttributesForReflectionOnlyType <ArgumentSetAttribute>(property).Should().BeEmpty();
        }
        public void CypherQueryBuilderServiceCheckGraphModelIntegrityReturnsSuccess()
        {
            foreach (var graphNodeType in AttributeUtilities.GetTypesWithAttribute(Assembly.GetAssembly(typeof(WebJobsExtensionStartup)), typeof(GraphNodeAttribute)))
            {
                //arrange
                int intialKeyCount      = 0;
                int keyCount            = 0;
                int preferredLabelCount = 0;

                //act
                foreach (var propertyInfo in graphNodeType !.GetProperties())
                {
                    var graphPropertyAttribute = propertyInfo.GetCustomAttributes(typeof(GraphPropertyAttribute), false).FirstOrDefault() as GraphPropertyAttribute;
                    if (graphPropertyAttribute != null && graphPropertyAttribute.IsInitialKey && !graphPropertyAttribute.Ignore)
                    {
                        intialKeyCount++;
                    }

                    if (graphPropertyAttribute != null && graphPropertyAttribute.IsKey && !graphPropertyAttribute.Ignore)
                    {
                        keyCount++;
                    }

                    if (graphPropertyAttribute != null && graphPropertyAttribute.IsPreferredLabel && !graphPropertyAttribute.Ignore)
                    {
                        preferredLabelCount++;
                    }
                }

                //assert
                Assert.Equal(1, intialKeyCount);
                Assert.NotEqual(0, keyCount);
                Assert.Equal(1, preferredLabelCount);
            }
        }
        public void TestThatPropertyWithNoAttributesYieldsNoAttributes()
        {
            var field = this.GetType().GetTypeInfo().GetMember(nameof(PropertyWithNoAttributes))[0];

            AttributeUtilities.GetAttributes <Attribute>(field).Should().BeEmpty();
            AttributeUtilities.GetAttributesForReflectionOnlyType <Attribute>(field).Should().BeEmpty();
        }
        public void MethodWithAttributeYieldsAttribute()
        {
            var method  = this.GetType().GetTypeInfo().GetMember(nameof(MethodWithAttributeYieldsAttribute))[0];
            var attribs = AttributeUtilities.GetAttributes <TestMethodAttribute>(method).ToList();

            attribs.Should().HaveCount(1);
            attribs[0].Should().BeOfType <TestMethodAttribute>();
        }
Beispiel #5
0
        public static ChatCommandId FromType <T>() where T : IChatCommand
        {
            ChatCommandAttribute cacheableAttribute = (ChatCommandAttribute)AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>();

            if (cacheableAttribute != null)
            {
                return(new ChatCommandId(cacheableAttribute.Name));
            }
            return(new ChatCommandId((string)null));
        }
Beispiel #6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PropertyInfo[] properties     = this.GetType().GetProperties();
            PropertyInfo[] compProperties = obj.GetType().GetProperties();

            if (properties.Length != compProperties.Length)
            {
                return(false);
            }

            for (int i = 0; i < properties.Length; i++)
            {
                ColumnAttribute attribute     = AttributeUtilities.GetColumnAttribute(properties[i]);
                ColumnAttribute compAttribute = AttributeUtilities.GetColumnAttribute(compProperties[i]);

                if (attribute != null)
                {
                    if (compAttribute == null)
                    {
                        return(false);
                    }
                    else
                    {
                        MethodInfo m1 = properties[i].GetGetMethod();
                        MethodInfo m2 = compProperties[i].GetGetMethod();

                        Object o1 = m1.Invoke(this, null);
                        Object o2 = m2.Invoke(obj, null);

                        if (o1 == null && o2 == null)
                        {
                            continue;
                        }

                        if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
                        {
                            return(false);
                        }

                        if (!o1.Equals(o2))
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
        public TService GetService <TService>() where TService : class
        {
            Type serviceInterface = typeof(TService);
            Guid interfaceGuid;

            if (!AttributeUtilities.TryGetInterfaceGuid(serviceInterface, out interfaceGuid))
            {
                throw new ArgumentException($"Service Interface {serviceInterface.FullName} does not expose Guid Attribute!");
            }
            else
            {
                return(GetService <TService>(interfaceGuid));
            }
        }
Beispiel #8
0
    /// <inheritdoc />
    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        Debug.Assert(Context != null);

        builder.OpenElement(0, "input");
        builder.AddMultipleAttributes(1, AdditionalAttributes);
        builder.AddAttributeIfNotNullOrEmpty(2, "class", AttributeUtilities.CombineClassNames(AdditionalAttributes, Context.FieldClass));
        builder.AddAttribute(3, "type", "radio");
        builder.AddAttribute(4, "name", Context.GroupName);
        builder.AddAttribute(5, "value", BindConverter.FormatValue(Value?.ToString()));
        builder.AddAttribute(6, "checked", Context.CurrentValue?.Equals(Value));
        builder.AddAttribute(7, "onchange", Context.ChangeEventCallback);
        builder.CloseElement();
    }
        public void CannotRetrieveAttributeFromNonMemberProviderThatFailsToReturnCustomAttribs()
        {
            var fooProp = typeof(TestClassWithAttributes).GetTypeInfo().GetProperty(nameof(TestClassWithAttributes.Foo));

            fooProp.Should().NotBeNull();

            var provider = Substitute.For <ICustomAttributeProvider>();

            provider.GetCustomAttributes(Arg.Any <Type>(), Arg.Any <bool>())
            .ReturnsForAnyArgs(call => { throw new InvalidOperationException(); });

            Action a = () => AttributeUtilities.GetAttributes <NamedArgumentAttribute>(provider).ToList();

            a.ShouldThrow <InvalidOperationException>();
        }
        public static List <Property> ToProperties(this ContactModel model)
        {
            List <Property> Properties = new List <Property>();
            Type            ClassType  = model.GetType();

            foreach (var property in ClassType.GetProperties())
            {
                Property propertyModel = new Property();
                string   Name          = AttributeUtilities.GetDescription <DescriptionAttribute>(property);
                propertyModel.PropertyName = string.IsNullOrEmpty(Name) ? property.Name : Name;
                propertyModel.Value        = Convert.ToString(property.GetValue(model));
                Properties.Add(propertyModel);
            }
            return(Properties);
        }
        public static List <Property> ClassPropertyToDictionary <T>(object classObject)
        {
            List <Property> Properties = new List <Property>();
            Type            ClassType  = classObject.GetType();

            foreach (var property in ClassType.GetProperties())
            {
                Property propertyModel = new Property();
                string   Name          = AttributeUtilities.GetDescription <T>(property);
                propertyModel.PropertyName = string.IsNullOrEmpty(Name) ? property.Name : Name;
                propertyModel.Value        = Convert.ToString(property.GetValue(classObject));
                Properties.Add(propertyModel);
            }
            return(Properties);
        }
        public void TestThatMethodWithAttributeYieldsAttribute()
        {
            var method = this.GetType().GetTypeInfo().GetMember(nameof(TestThatMethodWithAttributeYieldsAttribute))[0];

            var attribsResults = new[]
            {
                AttributeUtilities.GetAttributes <TestMethodAttribute>(method).ToList(),
                AttributeUtilities.GetAttributesForReflectionOnlyType <TestMethodAttribute>(method).ToList(),
            };

            foreach (var attribs in attribsResults)
            {
                attribs.Should().ContainSingle();
                attribs[0].Should().BeOfType <TestMethodAttribute>();
            }
        }
        public override string CreateSerializationQuery()
        {
            StringBuilder queryPt1 = new StringBuilder();
            StringBuilder queryPt2 = new StringBuilder();

            queryPt1.Append("UPDATE ").Append(base.table).Append(" SET ");
            queryPt2.Append(" WHERE ");

            bool startPt1 = true;
            bool startPt2 = true;

            for (int i = 0; i < base.properties.Length; i++)
            {
                ColumnAttribute attribute = AttributeUtilities.GetColumnAttribute(base.properties[i]);

                if (attribute != null)
                {
                    Object ret = base.properties[i].GetGetMethod().Invoke(base.data, null);
                    if (!(attribute is IPrimaryKeyAttribute) && ret != null)
                    {
                        if (!startPt1)
                        {
                            queryPt1.Append(", ");
                        }
                        startPt1 = false;
                        SqlConvert(ref ret);
                        queryPt1.Append(AttributeUtilities.GetColumnMapping(base.properties[i])).Append(" = ").Append(ret);
                    }
                    else if (attribute is IPrimaryKeyAttribute && ret != null)
                    {
                        if (!startPt2)
                        {
                            queryPt2.Append(" AND ");
                        }
                        startPt2 = false;
                        SqlConvert(ref ret);
                        queryPt2.Append(AttributeUtilities.GetColumnMapping(base.properties[i])).Append(" = ").Append(ret);
                    }
                    else if (attribute is IPrimaryKeyAttribute && ret == null)
                    {
                        throw new SerializerException("All primary keys must be set for UpdateByPrimaryKeySerializationStrategy to work!");
                    }
                }
            }

            return(queryPt1.Append(queryPt2).ToString());
        }
Beispiel #14
0
        protected List <String> GetConstrainingAttributes(String op)
        {
            List <string> list = new List <string>();

            PropertyInfo[] properties = data.GetType().GetProperties();
            foreach (PropertyInfo property in properties)
            {
                ColumnAttribute attribute =
                    (ColumnAttribute)Attribute.GetCustomAttribute(property, typeof(ColumnAttribute));


                if (attribute != null)
                {
                    MethodInfo method = property.GetGetMethod();
                    Object     ret    = method.Invoke(data, null);
                    SqlConvert(ref ret);
                    if (data.ContainsConstrainingAttribute(QueryStrategyConfiguration.PRIMARYKEY) && attribute is IPrimaryKeyAttribute)
                    {
                        StringBuilder tmp   = new StringBuilder().Append(AttributeUtilities.GetColumnMapping(property));
                        string        equal = " " + op + " ";
                        if (ret.ToString().Equals("NULL"))
                        {
                            equal = " IS ";
                        }

                        tmp.Append(equal).Append(ret.ToString());
                        list.Add(tmp.ToString());
                    }
                    else if (
                        data.ContainsConstrainingAttribute(property.Name) ||
                        data.ContainsConstrainingAttribute(AttributeUtilities.GetColumnMapping(property))
                        )
                    {
                        StringBuilder tmp   = new StringBuilder().Append(AttributeUtilities.GetColumnMapping(property));
                        string        equal = " " + op + " ";
                        if (ret.ToString().Equals("NULL"))
                        {
                            equal = " IS ";
                        }

                        tmp.Append(equal).Append(ret.ToString());
                        list.Add(tmp.ToString());
                    }
                }
            }
            return(list);
        }
        public void TestThatTypeWithAttributesYieldsAttributes()
        {
            var type = typeof(TestClassWithAttributes);

            var attribsResults = new[]
            {
                AttributeUtilities.GetAttributes <ArgumentSetAttribute>(type),
                AttributeUtilities.GetAttributesForReflectionOnlyType <ArgumentSetAttribute>(type)
            };

            foreach (var attribs in attribsResults)
            {
                attribs.Should().HaveCount(1);
                var attrib = attribs.First();
                attrib.Description.Should().Be("Hello");
                attrib.Examples.Should().BeEmpty();
            }
        }
        public void CanRetrieveAttributeFromProviderThatFailsToReturnCustomAttribs()
        {
            var fooProp = typeof(TestClassWithAttributes).GetTypeInfo().GetProperty(nameof(TestClassWithAttributes.Foo));

            fooProp.Should().NotBeNull();

            var provider = Substitute.For <MemberInfo>();

            ((ICustomAttributeProvider)provider).GetCustomAttributes(Arg.Any <Type>(), Arg.Any <bool>())
            .ReturnsForAnyArgs(call => { throw new InvalidOperationException(); });
            provider.CustomAttributes.ReturnsForAnyArgs(fooProp.CustomAttributes);

            var attribs = AttributeUtilities.GetAttributes <NamedArgumentAttribute>(provider).ToList();

            attribs.Should().HaveCount(1);
            attribs[0].Should().BeOfType <NamedArgumentAttribute>();
            attribs[0].LongName.Should().Be("LongerFoo");
        }
        public override string CreateSerializationQuery()
        {
            StringBuilder queryPt1 = new StringBuilder();

            queryPt1.Append("INSERT INTO ").Append(base.table).Append(" (");
            StringBuilder queryPt2 = new StringBuilder();

            queryPt2.Append(") VALUES (");


            bool start = true;

            for (int i = 0; i < base.properties.Length; i++)
            {
                ColumnAttribute attribute = AttributeUtilities.GetColumnAttribute(base.properties[i]);

                if (attribute != null && !(attribute is AutoIncPrimaryKeyAttribute))
                {
                    if (!start)
                    {
                        queryPt1.Append(", ");
                        queryPt2.Append(", ");
                    }
                    start = false;

                    MethodInfo m   = base.properties[i].GetGetMethod();
                    Object     ret = m.Invoke(base.data, null);

                    if (attribute is IPrimaryKeyAttribute && ret == null)
                    {
                        throw new SerializerException("All non-auto-incrementing primary keys must be set for InsertSerializationQueryStrategy to work!");
                    }

                    SqlConvert(ref ret);

                    queryPt1.Append(AttributeUtilities.GetColumnMapping(properties[i]));
                    queryPt2.Append(ret.ToString());
                }
            }

            queryPt2.Append(")");

            return(queryPt1.Append(queryPt2).ToString());
        }
        public void TestThatPropertyWithAttributesYieldsAttributes()
        {
            var property = typeof(TestClassWithAttributes).GetTypeInfo().GetMember(nameof(TestClassWithAttributes.Foo))[0];

            var attribsResults = new[]
            {
                AttributeUtilities.GetAttributes <NamedArgumentAttribute>(property),
                AttributeUtilities.GetAttributesForReflectionOnlyType <NamedArgumentAttribute>(property)
            };

            foreach (var attribs in attribsResults)
            {
                attribs.Should().HaveCount(1);
                var attrib = attribs.First();
                attrib.Flags.Should().Be(ArgumentFlags.Required);
                attrib.LongName.Should().Be("LongerFoo");
                attrib.ConflictsWith.Should().Equal(new[] { "Bar" });
            }
        }
Beispiel #19
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            string        commandKey = "ChatCommand." + ((ChatCommandAttribute)AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>()).Name;
            ChatCommandId index      = ChatCommandId.FromType <T>();

            this._commands[index] = (IChatCommand)Activator.CreateInstance <T>();
            if (Language.Exists(commandKey))
            {
                this._localizedCommands.Add(Language.GetText(commandKey), index);
            }
            else
            {
                commandKey += "_";
                foreach (LocalizedText key in Language.FindAll((LanguageSearchFilter)((key, text) => key.StartsWith(commandKey))))
                {
                    this._localizedCommands.Add(key, index);
                }
            }
            return(this);
        }
        public override string CreateSerializationQuery()
        {
            StringBuilder queryPt1 = new StringBuilder();

            queryPt1.Append("DELETE FROM ").Append(base.table).Append(" WHERE (");


            bool start = true;

            for (int i = 0; i < base.properties.Length; i++)
            {
                ColumnAttribute attribute = AttributeUtilities.GetColumnAttribute(base.properties[i]);

                if (attribute is IPrimaryKeyAttribute)
                {
                    if (!start)
                    {
                        queryPt1.Append(" AND ");
                    }

                    MethodInfo m   = base.properties[i].GetGetMethod();
                    Object     ret = m.Invoke(base.data, null);

                    if (ret == null)
                    {
                        throw new SerializerException("All primary keys must be set for RemoveSerializationQueryStrategy to work!");
                    }

                    SqlConvert(ref ret);

                    queryPt1.Append(AttributeUtilities.GetColumnMapping(properties[i]));
                    queryPt1.Append(" = ");
                    queryPt1.Append(ret.ToString());
                    start = false;
                }
            }

            queryPt1.Append(")");

            return(queryPt1.ToString());
        }
Beispiel #21
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>();
            string        commandKey    = "ChatCommand." + cacheableAttribute.Name;
            ChatCommandId chatCommandId = ChatCommandId.FromType <T>();

            _commands[chatCommandId] = new T();
            if (Language.Exists(commandKey))
            {
                _localizedCommands.Add(Language.GetText(commandKey), chatCommandId);
            }
            else
            {
                commandKey += "_";
                LocalizedText[] array = Language.FindAll((string key, LocalizedText text) => key.StartsWith(commandKey));
                foreach (LocalizedText key2 in array)
                {
                    _localizedCommands.Add(key2, chatCommandId);
                }
            }
            return(this);
        }
Beispiel #22
0
        /// <summary>
        /// Toes the string helper.
        /// </summary>
        /// <param name="data">The ISerializableObject object.</param>
        /// <param name="descriptionLength">Length of the description.</param>
        /// <returns></returns>
        protected string ToStringHelper(SerializableObject data, int descriptionLength)
        {
            System.Text.StringBuilder ret = new System.Text.StringBuilder();

            for (int i = 0; i < descriptionLength; i++)
            {
                ret.Append("-");
            }
            ret.Append("\n");
            ret.Append(AttributeUtilities.GetTableMapping(data)).Append(" Row\n");
            for (int i = 0; i < descriptionLength; i++)
            {
                ret.Append("-");
            }
            ret.Append("\n");

            PropertyInfo[] properties = data.GetType().GetProperties();
            foreach (PropertyInfo property in properties)
            {
                ColumnAttribute attribute = AttributeUtilities.GetColumnAttribute(property);

                if (attribute != null)
                {
                    string columnName = AttributeUtilities.GetColumnMapping(property);
                    ret.Append(columnName);
                    for (int i = columnName.Length; i < descriptionLength; i++)
                    {
                        ret.Append(".");
                    }
                    ret.Append(": ");
                    MethodInfo m   = property.GetGetMethod();
                    Object     obj = m.Invoke(data, null);
                    ret.Append(obj);
                    ret.Append("\n");
                }
            }
            return(ret.ToString());
        }
Beispiel #23
0
        // Token: 0x06001347 RID: 4935 RVA: 0x0041B370 File Offset: 0x00419570
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>();
            string        commandKey    = "ChatCommand." + cacheableAttribute.Name;
            ChatCommandId chatCommandId = ChatCommandId.FromType <T>();

            this._commands[chatCommandId] = Activator.CreateInstance <T>();
            if (Language.Exists(commandKey))
            {
                this._localizedCommands.Add(Language.GetText(commandKey), chatCommandId);
            }
            else
            {
                commandKey += "_";
                LocalizedText[] array = Language.FindAll((string key, LocalizedText text) => key.StartsWith(commandKey));
                for (int i = 0; i < array.Length; i++)
                {
                    LocalizedText key2 = array[i];
                    this._localizedCommands.Add(key2, chatCommandId);
                }
            }
            return(this);
        }
Beispiel #24
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            var commandKey = "ChatCommand." +
                             AttributeUtilities
                             .GetCacheableAttribute <T, ChatCommandAttribute>().Name;
            var index = ChatCommandId.FromType <T>();

            _commands[index] = new T();
            if (Language.Exists(commandKey))
            {
                _localizedCommands.Add(Language.GetText(commandKey), index);
            }
            else
            {
                commandKey += "_";
                foreach (var key in Language.FindAll((key, text) =>
                                                     key.StartsWith(commandKey)))
                {
                    _localizedCommands.Add(key, index);
                }
            }

            return(this);
        }
        public static dynamic ConvertToPropertyList(this ContactProperty model, bool create = false)
        {
            List <dynamic> properties = new List <dynamic>();
            Type           type       = model.GetType();

            foreach (var property in type.GetProperties())
            {
                Dictionary <string, string> prop = new Dictionary <string, string>();
                string propType, propName, propSubType, propValue = string.Empty;
                bool   typeExist = false;
                bool   subTypeExist = false;

                propType = AttributeUtilities.GetTypeValue(property, typeof(PropertyAttribute));

                //Assign values
                if (DataTypes.Any(x => x.ToLower() == property.PropertyType.Name.ToLower()))
                {
                    propValue = Convert.ToString(property.GetValue(model));
                }
                else
                {
                    if (property.GetValue(model, null).GetType() == typeof(Dictionary <string, object>))
                    {
                        Dictionary <string, object> CustomFields = property.GetValue(model, null) as Dictionary <string, object>;
                        if (CustomFields != null && CustomFields.Count > 0)
                        {
                            foreach (var item in CustomFields)
                            {
                                #region Key Value Conversion
                                //var CustomValue = JsonConvert.SerializeObject(item.Value,
                                //    new JsonSerializerSettings()
                                //    {
                                //        NullValueHandling = NullValueHandling.Ignore,
                                //        DefaultValueHandling = DefaultValueHandling.Ignore,
                                //        Converters = new List<Newtonsoft.Json.JsonConverter> {
                                //    new Newtonsoft.Json.Converters.StringEnumConverter()
                                //    }
                                //    });

                                //if (string.IsNullOrEmpty(CustomValue) || string.Equals(CustomValue, "{}") || string.Equals(CustomValue, "[]"))
                                //    continue;
                                //else
                                //{
                                //    if (!string.IsNullOrEmpty(propType))
                                //    {
                                //        properties.Add(new
                                //        {
                                //            type = propType,
                                //            name = item.Key,
                                //            value = CustomValue
                                //        });
                                //    }
                                //    else
                                //    {
                                //        properties.Add(new
                                //        {
                                //            name = item.Key,
                                //            value = CustomValue
                                //        });
                                //    }
                                //}
                                #endregion

                                if (item.Value != null)
                                {
                                    var ChildObject = item.Value;
                                    foreach (var childProperty in item.Value.GetType().GetProperties())
                                    {
                                        propValue = Convert.ToString(childProperty.GetValue(ChildObject, null));
                                        propType  = AttributeUtilities.GetTypeValue(childProperty, typeof(PropertyAttribute));
                                        propName  = AttributeUtilities.GetName(childProperty, typeof(PropertyAttribute));

                                        if (!string.IsNullOrEmpty(propValue))
                                        {
                                            properties.Add(new
                                            {
                                                type  = propType,
                                                name  = propName,
                                                value = propValue
                                            });
                                        }
                                    }
                                }
                            }
                        }
                        continue;
                    }
                    else
                    {
                        propValue = JsonConvert.SerializeObject(property.GetValue(model),
                                                                new JsonSerializerSettings()
                        {
                            NullValueHandling    = NullValueHandling.Ignore,
                            DefaultValueHandling = DefaultValueHandling.Ignore,
                            Converters           = new List <Newtonsoft.Json.JsonConverter> {
                                new Newtonsoft.Json.Converters.StringEnumConverter()
                            }
                        });
                    }
                }

                propName    = AttributeUtilities.GetName(property, typeof(PropertyAttribute));
                propSubType = AttributeUtilities.GetSubTypeValue(property, typeof(PropertyAttribute));

                if (propValue == "null" || string.IsNullOrEmpty(propValue))
                {
                    continue;
                }
                else
                {
                    prop.Add("value", propValue);
                }

                if (!string.IsNullOrEmpty(propType))
                {
                    prop.Add("type", propType);
                    typeExist = true;
                }

                if (!string.IsNullOrEmpty(propName))
                {
                    prop.Add("name", propName);
                }

                if (!string.IsNullOrEmpty(propSubType) && !create)
                {
                    prop.Add("subtype", "propSubType");
                    subTypeExist = true;
                }

                if (typeExist && subTypeExist)
                {
                    properties.Add(new
                    {
                        type    = prop["type"],
                        name    = prop["name"],
                        value   = prop["value"],
                        subtype = prop["subtype"]
                    });
                }
                else if (typeExist)
                {
                    properties.Add(new
                    {
                        type  = prop["type"],
                        name  = prop["name"],
                        value = prop["value"]
                    });
                }
                else if (subTypeExist)
                {
                    properties.Add(new
                    {
                        name    = prop["name"],
                        value   = prop["value"],
                        subtype = prop["subtype"]
                    });
                }
            }
            return(properties);
        }
Beispiel #26
0
 protected QueryStrategy(ISerializableObject data)
 {
     this.data  = data;
     table      = AttributeUtilities.GetTableMapping(data);
     properties = data.GetType().GetProperties();
 }
        public void PropertyWithNoAttributesYieldsNoAttributes()
        {
            var field = this.GetType().GetTypeInfo().GetMember(nameof(PropertyWithNoAttributes))[0];

            AttributeUtilities.GetAttributes <Attribute>(field).Should().BeEmpty();
        }