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