예제 #1
0
        public void JsonParserFailsToParseDoubleDoubleQuotes()
        {
            string   createTableJsonResponse = GetReportTextContent();
            JsonItem job;

            using (var jsonParser = new JsonParser(createTableJsonResponse))
            {
                job = jsonParser.ParseNext();
                if (job.IsError)
                {
                    JsonParseError error = (JsonParseError)job;
                    Assert.Fail(error.ToString());
                }
            }
            string queryText;

            Assert.IsTrue(job.GetProperty("execute").TryGetValue(out queryText), "unable to retrieve the query text string");
            Assert.AreEqual("\"select * from hivesampletable limit10\"", queryText);
        }
예제 #2
0
        public void JsonParserFailsToParseEmptyObject()
        {
            string createTableJsonResponse =
                "{\"status\": \" abc\\t abc\\r abc\\n abc\\b abc\\f abc\\\\ abc\\f abc\\u0041 \", \"number\" : 2 }";
            JsonItem job;

            using (var jsonParser = new JsonParser(createTableJsonResponse))
            {
                job = jsonParser.ParseNext();
                if (job.IsError)
                {
                    JsonParseError error = (JsonParseError)job;
                    Assert.Fail(error.ToString());
                }
            }
            string statusString;

            Assert.IsTrue(job.GetProperty("status").TryGetValue(out statusString), "unable to retrieve the status string");
            Assert.AreEqual(" abc\t abc\r abc\n abc\b abc\f abc\\ abc\f abcA ", statusString);
        }