示例#1
0
 public void BackslasheEscaping()
 {
     Assert.AreEqual(@"""c:\\foo\\bar""", JsonString.Enquote(@"c:\foo\bar"));
 }
示例#2
0
 public void QuoteEscaping()
 {
     Assert.AreEqual("\"foo \\\"quoted\\\" bar\"", JsonString.Enquote("foo \"quoted\" bar"));
 }
示例#3
0
 public void NullInputYieldsQuotedEmpty()
 {
     Assert.AreEqual("\"\"", JsonString.Enquote(null));
 }
示例#4
0
 public void EmptyInputYieldsQuotedEmpty()
 {
     Assert.AreEqual("\"\"", JsonString.Enquote(string.Empty));
 }
示例#5
0
 public void CannotEnquoteWithNegativeLength()
 {
     JsonString.Enquote(new char[0], 0, -1);
 }
示例#6
0
 public void CannotEnquoteWithBadRange()
 {
     JsonString.Enquote(new char[10], 5, 10);
 }
示例#7
0
 public void CannotEnquoteWithNullCharBuffer()
 {
     JsonString.Enquote(null, 0, 0);
 }
示例#8
0
 public void TabEscaping()
 {
     Assert.AreEqual("\"\\t\"", JsonString.Enquote(((char)09).ToString()));
 }
示例#9
0
 public void NullStringBuilderCreatesOne()
 {
     Assert.IsNotNull(JsonString.Enquote(string.Empty, null));
 }
示例#10
0
 public void NullStringWithNullStringBuilderYieldsQuotedEmpty()
 {
     Assert.AreEqual("\"\"", JsonString.Enquote(null, null).ToString());
 }
示例#11
0
 public void CarriageReturnEscaping()
 {
     Assert.AreEqual("\"\\r\"", JsonString.Enquote(((char)13).ToString()));
 }
示例#12
0
 public void FormFeedEscaping()
 {
     Assert.AreEqual("\"\\f\"", JsonString.Enquote(((char)12).ToString()));
 }
示例#13
0
 public void LineFeedEscaping()
 {
     Assert.AreEqual("\"\\n\"", JsonString.Enquote(((char)10).ToString()));
 }
示例#14
0
 public void GreaterThanEscaping()
 {
     Assert.AreEqual("\"foo <b>bold<\\/b> bar\"", JsonString.Enquote("foo <b>bold</b> bar"));
 }
示例#15
0
 public void CannotEnquoteWithNegativeOffset()
 {
     JsonString.Enquote(new char[0], -1, 0);
 }
示例#16
0
 protected override void WriteStringImpl(string value)
 {
     WriteScalar(JsonString.Enquote(value));
 }
示例#17
0
 public void BackspaceEscaping()
 {
     Assert.AreEqual("\"\\b\"", JsonString.Enquote(((char)08).ToString()));
 }