Beispiel #1
0
        /// <summary>
        /// Returns the child members of the member.
        /// </summary>
        /// <returns></returns>
        public virtual IList <IMessageMember> GetChildren()
        {
            if (!HasChildren)
            {
                return(null);
            }

            return(MessageReporter.GetMembers(_source));
        }
Beispiel #2
0
 /// <summary>
 /// Returns the child members of the member.
 /// </summary>
 /// <returns></returns>
 public override IList <IMessageMember> GetChildren()
 {
     if (!HasChildren)
     {
         return(null);
     }
     else
     {
         return(MessageReporter.GetListItems(_list));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Report a message object in plain text ou html.
        /// <remarks>TODO: xml report</remarks>
        /// </summary>
        /// <param name="instance">The message instance to report.</param>
        /// <param name="reportingType">The reporting type.</param>
        /// <returns>The report.</returns>
        public static string Report(object instance, ReportingType reportingType)
        {
            if (null == instance)
            {
                throw new InvalidOperationException("Error: the message object instance could not be null!");
            }

            StringBuilder concat = new StringBuilder();

            string messageType        = Messages.InferMessageType(instance);
            string messageDescription = Messages.GetMessage(messageType).ToString();

            concat.AppendFormat("{0}{1}", messageDescription, Environment.NewLine);

            List <IMessageMember> list = MessageReporter.GetMembers(instance);
            int indent = 0;

            foreach (IMessageMember member in list)
            {
                TraverseMessage(member, reportingType, ref concat, ref indent);
            }

            return(concat.ToString());
        }