Beispiel #1
0
        public void StringFormattingIsApplied(string value, string format, string expected)
        {
            var formatter = new ThemedDisplayValueFormatter(DefaultThemes.None, null);
            var sw        = new StringWriter();

            formatter.FormatLiteralValue(new ScalarValue(value), sw, format);
            var actual = sw.ToString();

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        protected override int VisitScalarValue(ThemedValueFormatterState state, ScalarValue scalar)
        {
            if (scalar == null)
            {
                throw new ArgumentNullException(nameof(scalar));
            }

            // At the top level, for scalar values, use "display" rendering.
            if (state.IsTopLevel)
            {
                return(_displayFormatter.FormatLiteralValue(scalar, state.Output, state.Format));
            }

            return(FormatLiteralValue(scalar, state.Output));
        }