Example #1
0
        public void FixJsonCommas_CloseBraceFollowedByCloseBraceWithNewLines_CommaRemoved()
        {
            var json =
                "{" + Environment.NewLine +
                " {" + Environment.NewLine +
                " \"foo\": \"bar\"" + Environment.NewLine +
                " }, " + Environment.NewLine +
                " {" + Environment.NewLine +
                " \"foo\": \"bar\"" + Environment.NewLine +
                " }, " + Environment.NewLine +
                "}";
            var expected =
                "{" + Environment.NewLine +
                " {" + Environment.NewLine +
                " \"foo\": \"bar\"" + Environment.NewLine +
                " }, " + Environment.NewLine +
                " {" + Environment.NewLine +
                " \"foo\": \"bar\"" + Environment.NewLine +
                " } " + Environment.NewLine +
                "}";

            var actual = new JsonFileFixerService().Fix(json);

            Assert.Equal(expected, actual);
        }
Example #2
0
        public void FixJsonCommas_DoubleQuoteFollowedByCloseBrace_CommaRemoved()
        {
            var json =
                "{" +
                " \"foo\": \"bar\"," +
                " \"foo\": \"bar\", " +
                "}";
            var expected =
                "{" +
                " \"foo\": \"bar\"," +
                " \"foo\": \"bar\" " +
                "}";

            var actual = new JsonFileFixerService().Fix(json);

            Assert.Equal(expected, actual);
        }