本文整理汇总了C#中JsonReader.ReadNext方法的典型用法代码示例。如果您正苦于以下问题:C# JsonReader.ReadNext方法的具体用法?C# JsonReader.ReadNext怎么用?C# JsonReader.ReadNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonReader
的用法示例。
在下文中一共展示了JsonReader.ReadNext方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadsEscapedControlCharacters
public void ReadsEscapedControlCharacters()
{
var sr = new StringReader("\"this is escaped: \\b\\f\\n\\r\\t\\x17\"");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.String, reader.Token);
Assert.AreEqual("\"this is escaped: \\b\\f\\n\\r\\t\\x17\"", reader.Text);
}
示例2: ReadsEscapedUnicodeCharacters
public void ReadsEscapedUnicodeCharacters()
{
var sr = new StringReader("\"this is escaped: \\u3034\"");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.String, reader.Token);
Assert.AreEqual("\"this is escaped: \\u3034\"", reader.Text);
}
示例3: ReadsNonEscapedString
public void ReadsNonEscapedString()
{
var sr = new StringReader("\"hello, world\"");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.String, reader.Token);
Assert.AreEqual("\"hello, world\"", reader.Text);
}
示例4: ReadsEscapedQuoteString
public void ReadsEscapedQuoteString()
{
var sr = new StringReader("\"this is escaped: \\\"\"");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.String, reader.Token);
Assert.AreEqual("\"this is escaped: \\\"\"", reader.Text);
}
示例5: ReadsSimpleReal
public void ReadsSimpleReal()
{
var sr = new StringReader("123.0");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.Real, reader.Token);
Assert.AreEqual("123.0", reader.Text);
}
示例6: ReadsExponentialNegativeReal
public void ReadsExponentialNegativeReal()
{
var sr = new StringReader("-123.0e1");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.Real, reader.Token);
Assert.AreEqual("-123.0e1", reader.Text);
}
示例7: ReadsArrayEnd
public void ReadsArrayEnd()
{
var sr = new StringReader("]");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.ArrayEnd, reader.Token);
Assert.AreEqual("]", reader.Text);
}
示例8: ReadsColon
public void ReadsColon()
{
var sr = new StringReader(":");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.Colon, reader.Token);
Assert.AreEqual(":", reader.Text);
}
示例9: ReadsObjectStart
public void ReadsObjectStart()
{
var sr = new StringReader("{");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.ObjectStart, reader.Token);
Assert.AreEqual("{", reader.Text);
}
示例10: ReadsNegativeInteger
public void ReadsNegativeInteger()
{
var sr = new StringReader("-123");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.Integer, reader.Token);
Assert.AreEqual("-123", reader.Text);
}
示例11: ReadsIdentifier
public void ReadsIdentifier()
{
var sr = new StringReader("Date");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.Identifier, reader.Token);
Assert.AreEqual("Date", reader.Text);
}
示例12: ReadsFalse
public void ReadsFalse()
{
var sr = new StringReader("false");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.False, reader.Token);
Assert.AreEqual("false", reader.Text);
}
示例13: ReadsNew
public void ReadsNew()
{
var sr = new StringReader("new Date()");
var reader = new JsonReader(sr);
Assert.IsTrue(reader.ReadNext(), "Failed read");
Assert.AreEqual(JsonTokenType.New, reader.Token);
Assert.AreEqual("new", reader.Text);
}