-Added support for Serializable attribute and MemberSerialization.Fields
-Added support for ignoring properties with NonSerializable attribute -Added MaxDepth to JsonReader/JsonSerializer/JsonSerializerSettings
This commit is contained in:
@@ -44,6 +44,25 @@ namespace Newtonsoft.Json.Tests
|
||||
[TestFixture]
|
||||
public class JsonTextReaderTest : TestFixtureBase
|
||||
{
|
||||
[Test]
|
||||
public void SurrogatePairValid()
|
||||
{
|
||||
string json = @"{ ""MATHEMATICAL ITALIC CAPITAL ALPHA"": ""\uD835\uDEE2"" }";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.IsTrue(reader.Read());
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.String, reader.TokenType);
|
||||
|
||||
string s = reader.Value.ToString();
|
||||
|
||||
StringInfo stringInfo = new StringInfo(s);
|
||||
Assert.AreEqual(1, stringInfo.LengthInTextElements);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CloseInput()
|
||||
{
|
||||
@@ -2195,6 +2214,26 @@ bye", reader.Value);
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MaxDepth()
|
||||
{
|
||||
string json = "[[]]";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json))
|
||||
{
|
||||
MaxDepth = 1
|
||||
};
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"This reader's MaxDepth of 1 has been exceeded.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadingFromSlowStream()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user