public string Format(DisplayActualOptions options)
            {
                // On recursion, no need to display types
                var  recursionOptions = options & ~DisplayActualOptions.ShowType;
                var  entries          = new StringBuilder();
                bool comma            = false;

                foreach (var e in _entries)
                {
                    if (comma)
                    {
                        entries.Append(", ");
                    }
                    entries.Append(e.property);
                    entries.Append(" = ");
                    entries.Append(e.actual.Format(recursionOptions));
                    comma = true;
                }

                // Show the type if it was requested or if there are no fields within
                string formatString = (entries.Length == 0 || options.ShowType())
                    ? "{0} {{ {1} }}"
                    : "{{ {1} }}";

                return(string.Format(
                           formatString, _schema.SimpleTypeName, entries
                           ));
            }
            public string Format(DisplayActualOptions options)
            {
                if (Exception == null)
                {
                    return("<no exception>");
                }
                var f = new ExceptionStackTraceFilter(Exception);

                return(f.ToString(options.ShowNoisyStackTrace()));
            }
Пример #3
0
            public string Format(DisplayActualOptions options)
            {
                string formatString = options.ShowType() ? "{0} {{ {1} }}" : "{{ {1} }}";

                // On recursion, no need to display types
                var recursionOptions = options & ~DisplayActualOptions.ShowType;

                return(string.Format(
                           formatString,
                           TextUtility.ConvertToSimpleTypeName(_type),
                           string.Join(", ", _values.Select(v => v.Format(recursionOptions)))
                           ));
            }
Пример #4
0
            public string Format(DisplayActualOptions options)
            {
                var w = Text;

                if (options.ShowWhitespace())
                {
                    w = TextUtility.ShowWhitespace(w);
                }
                if (options.ShowType())
                {
                    var type = TextUtility.ConvertToSimpleTypeName(Type);
                    w += $" ({type})";
                }
                return(w);
            }
Пример #5
0
            public string Format(DisplayActualOptions options)
            {
                var w = _text;

                if (_escape)
                {
                    w = string.Format("\"{0}\"", TextUtility.Escape(w));
                }

                if (options.ShowWhitespace())
                {
                    w = TextUtility.ShowWhitespace(w);
                }
                if (_text.Length == 0)
                {
                    w = "<empty>";
                }

                if (options.ShowType())
                {
                    return(w + " (string)");
                }
                return(w);
            }
Пример #6
0
 internal static bool ShowNoisyStackTrace(this DisplayActualOptions opts)
 {
     return((opts & DisplayActualOptions.ShowNoisyStackTrace) > 0);
 }
Пример #7
0
 internal static bool ShowWhitespace(this DisplayActualOptions opts)
 {
     return((opts & DisplayActualOptions.ShowWhitespace) > 0);
 }
Пример #8
0
 internal static bool ShowType(this DisplayActualOptions opts)
 {
     return((opts & DisplayActualOptions.ShowType) > 0);
 }
Пример #9
0
 public string Format(DisplayActualOptions options)
 {
     return("...");
 }