Esempio n. 1
0
            public void Run(RegressionEnvironment env)
            {
                string[][] testdata = {
                    new[] {"\t", "\"\\t\""},
                    new[] {"\n", "\"\\n\""},
                    new[] {"\r", "\"\\r\""},
                    new[] {Convert.ToString((char) 0), "\"\\u0000\""}
                };

                for (var i = 0; i < testdata.Length; i++) {
                    var buf = new StringBuilder();
                    OutputValueRendererJSONString.Enquote(testdata[i][0], buf);
                    Assert.AreEqual(testdata[i][1], buf.ToString());
                }
            }
Esempio n. 2
0
        private void RunAssertionEnquote()
        {
            var testdata = new string[][] {
                new string[] { "\t", "\"\\t\"" },
                new string[] { "\n", "\"\\n\"" },
                new string[] { "\r", "\"\\r\"" },
                new string[] { "\0", "\"\\u0000\"" },
            };

            for (int i = 0; i < testdata.Length; i++)
            {
                var buf = new StringBuilder();
                OutputValueRendererJSONString.Enquote(testdata[i][0], buf);
                Assert.AreEqual(testdata[i][1], buf.ToString());
            }
        }
Esempio n. 3
0
        public static void TestEnquote()
        {
            String[][] testdata =
            {
                new string[] { "\t",                 "\"\\t\""     },
                new string[] { "\n",                 "\"\\n\""     },
                new string[] { "\r",                 "\"\\r\""     },
                new string[] { ((char)0).ToString(), "\"\\u0000\"" },
            };

            for (int i = 0; i < testdata.Length; i++)
            {
                StringBuilder buf = new StringBuilder();
                OutputValueRendererJSONString.Enquote(testdata[i][0], buf);
                Assert.AreEqual(testdata[i][1], buf.ToString());
            }
        }