Esempio n. 1
0
        protected void VisitType(Type type)
        {
            var actions = new List <Action>();

            foreach (var property in type.GetProperties())
            {
                if (                /*Type.GetTypeCode(property.PropertyType) == TypeCode.Object &&*/
                    property.GetIndexParameters().Count() == 0)
                {
                    this.WriteIndent();
                    var propertyGetValue = property.GetValue(this.Object, null);
                    this.Writer.WriteLine("P_{0} : {1}", property.Name, propertyGetValue ?? "NULL");

                    if (propertyGetValue is IEnumerable)
                    {
                        var ienumberableObject = ((IEnumerable)propertyGetValue).GetEnumerator();

                        while (ienumberableObject.MoveNext())
                        {
                            var currentobject = ienumberableObject.Current;

                            var show = new ShowObject(currentobject, this.Writer, this.Indent + 1);
                            actions.Add(new Action(show.Show));
                        }
                    }

                    if (propertyGetValue != null &&
                        property.PropertyType.FullName != typeof(object).FullName &&
                        Type.GetTypeCode(property.PropertyType) == TypeCode.Object)
                    {
                        var show = new ShowObject(propertyGetValue, this.Writer, this.Indent + 1);
                        actions.Add(new Action(show.Show));
                    }
                }
            }

            actions.ForEach(action => action());
        }
Esempio n. 2
0
        protected void VisitType(Type type)
        {
            var actions = new List<Action>();
            foreach (var property in type.GetProperties())
            {
                if (/*Type.GetTypeCode(property.PropertyType) == TypeCode.Object &&*/
                    property.GetIndexParameters().Count() == 0)
                {
                    this.WriteIndent();
                    var propertyGetValue = property.GetValue(this.Object, null);
                    this.Writer.WriteLine("P_{0} : {1}", property.Name, propertyGetValue ?? "NULL");

                    if (propertyGetValue is IEnumerable)
                    {
                        var ienumberableObject = ((IEnumerable)propertyGetValue).GetEnumerator();

                        while(ienumberableObject.MoveNext())
                        {
                            var currentobject = ienumberableObject.Current;

                            var show = new ShowObject(currentobject, this.Writer, this.Indent + 1);
                            actions.Add(new Action(show.Show));
                        }
                    }

                    if (propertyGetValue != null &&
                        property.PropertyType.FullName != typeof(object).FullName &&
                        Type.GetTypeCode(property.PropertyType) == TypeCode.Object)
                    {
                        var show = new ShowObject(propertyGetValue, this.Writer, this.Indent + 1);
                        actions.Add(new Action(show.Show));
                    }
                }
            }

            actions.ForEach(action => action());
        }
Esempio n. 3
0
 public static void ShowObject(this TestContext testContext, object @object, TextWriter writer)
 {
     var show = new ShowObject(@object, writer);
     show.Show();
 }
Esempio n. 4
0
        public static void ShowObject(this TestContext testContext, object @object, TextWriter writer)
        {
            var show = new ShowObject(@object, writer);

            show.Show();
        }