Exemplo n.º 1
0
        /// <summary>
        /// Get properties.
        /// </summary>
        public static IReflectionProperties GetPropertiesDict(Type type)
        {
            var dict = new ReflectionProperties();

            return(type?.GetRuntimeProperties()?.Aggregate(dict, (d, p) =>
            {
                d[p.Name] = new ReflectionProperty(p);
                return d;
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get properties having a custom attribute.
        /// </summary>
        public static IReflectionProperties <TAttr> GetPropertiesDict <TAttr>(Type type) where TAttr : class
        {
            var dict = new ReflectionProperties <TAttr>();

            return(type?.GetRuntimeProperties()?.Aggregate(dict, (d, p) =>
            {
                TAttr attr = null;
                if (typeof(TAttr) == typeof(object) || (attr = TryGetAttribute <TAttr>(p)) != null)
                {
                    d[p.Name] = new ReflectionProperty <TAttr>(p, attr);
                }

                return d;
            }));
        }
Exemplo n.º 3
0
 protected override void BeforeTest(Commons.Spec.ExecutionModel.TestUnit test)
 {
     Value   = new PValues();
     Subject = new ReflectionProperties(Value);
 }