コード例 #1
0
 public void ObjectProperty(string propertyName, Action <JSONObject> propertyValueAction)
 {
     propertyName = JSBuilder.Quote(propertyName);
     jsObject.ObjectProperty(propertyName, (JSObject jsObject) =>
     {
         propertyValueAction.Invoke(new JSONObject(jsObject));
     });
 }
コード例 #2
0
 public void QuoteWithInternalBacktickQuote()
 {
     Assert.AreEqual("\"ab`c\"", JSBuilder.Quote("ab`c"));
 }
コード例 #3
0
 public void QuoteWithInternalDoubleQuote()
 {
     Assert.AreEqual("`ab\"c`", JSBuilder.Quote("ab\"c"));
 }
コード例 #4
0
 public void QuoteWithInternalSingleQuote()
 {
     Assert.AreEqual("\"ab'c\"", JSBuilder.Quote("ab'c"));
 }
コード例 #5
0
 public void QuoteWithSurroundingBacktickQuotes()
 {
     Assert.AreEqual("`abc`", JSBuilder.Quote("`abc`"));
 }
コード例 #6
0
 public void QuoteWithSurroundingDoubleQuotes()
 {
     Assert.AreEqual("\"abc\"", JSBuilder.Quote("\"abc\""));
 }
コード例 #7
0
 public void QuoteWithSurroundingSingleQuotes()
 {
     Assert.AreEqual("'abc'", JSBuilder.Quote("'abc'"));
 }
コード例 #8
0
 public void QuoteWithNonEmpty()
 {
     Assert.AreEqual("\"abc\"", JSBuilder.Quote("abc"));
 }
コード例 #9
0
 public void QuoteWithEmpty()
 {
     Assert.AreEqual("\"\"", JSBuilder.Quote(""));
 }
コード例 #10
0
 public void QuoteWithNull()
 {
     Assert.AreEqual("\"\"", JSBuilder.Quote(null));
 }
コード例 #11
0
 public void BooleanProperty(string propertyName, bool propertyValue)
 {
     propertyName = JSBuilder.Quote(propertyName);
     jsObject.BooleanProperty(propertyName, propertyValue);
 }
コード例 #12
0
 public void StringArrayProperty(string propertyName, IEnumerable <string> arrayElements)
 {
     propertyName = JSBuilder.Quote(propertyName);
     jsObject.QuotedStringArrayProperty(propertyName, arrayElements);
 }
コード例 #13
0
 public void StringProperty(string propertyName, string propertyValue)
 {
     propertyName  = JSBuilder.Quote(propertyName);
     propertyValue = JSBuilder.Quote(propertyValue);
     jsObject.TextProperty(propertyName, propertyValue);
 }