Ejemplo n.º 1
0
        public object VisitObject(Func <Type, object> recurse, Type objectType, SortedDictionary <string, Type> fields)
        {
            return(this.GenerateRandom(objectType, () =>
            {
                var asList = fields.ToArray();

                var fieldNames = new string[asList.Length];
                var values = new object[asList.Length];

                for (int i = 0; i < asList.Length; i++)
                {
                    fieldNames[i] = asList[i].Key;
                    values[i] = recurse(asList[i].Value);
                }

                return ReflectionUtilities.CreateInstance(objectType, fieldNames, values);
            }));
        }