Refactor some cases of repeated code into separate methods.

Make the MoveToContent() and ReadToContent() produced from this public.
This commit is contained in:
Jon Hanna
2015-12-20 00:28:40 +00:00
parent dca5260334
commit a06716c6a6
18 changed files with 351 additions and 503 deletions
@@ -264,7 +264,7 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void DeserializeBasicUnion_UnexpectedEnd()
{
ExceptionAssert.Throws<JsonSerializationException>(() => JsonConvert.DeserializeObject<Currency>(@"{""Case"":"), "Unexpected end when reading union. Path 'Case', line 1, position 8.");
ExceptionAssert.Throws<JsonSerializationException>(() => JsonConvert.DeserializeObject<Currency>(@"{""Case"":"), "Unexpected end when reading JSON. Path 'Case', line 1, position 8.");
}
[Test]
@@ -158,7 +158,7 @@ namespace Newtonsoft.Json.Tests.Converters
ExceptionAssert.Throws<JsonException>(() =>
{
converter.ReadJson(writer, typeof (JsonValue), null, null);
}, "Unexpected end. Path '', line 1, position 1.");
}, "Unexpected end when reading JSON. Path '', line 1, position 1.");
}
[Test]
@@ -173,7 +173,7 @@ namespace Newtonsoft.Json.Tests.Converters
ExceptionAssert.Throws<JsonException>(() =>
{
converter.ReadJson(writer, typeof (JsonValue), null, null);
}, "Unexpected end. Path '', line 1, position 13.");
}, "Unexpected end when reading JSON. Path '', line 1, position 13.");
}
[Test]
@@ -188,7 +188,7 @@ namespace Newtonsoft.Json.Tests.Converters
ExceptionAssert.Throws<JsonException>(() =>
{
converter.ReadJson(writer, typeof (JsonValue), null, null);
}, "Unexpected end. Path 'hi', line 1, position 6.");
}, "Unexpected end when reading JSON. Path 'hi', line 1, position 6.");
}
[Test]
@@ -60,7 +60,7 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void DeserializeUnexpectedEnd()
{
ExceptionAssert.Throws<JsonSerializationException>(() => JsonConvert.DeserializeObject<KeyValuePair<string, int>>(@"{""Key"": ""123"","), "Unexpected end when reading KeyValuePair. Path 'Key', line 1, position 14.");
ExceptionAssert.Throws<JsonSerializationException>(() => JsonConvert.DeserializeObject<KeyValuePair<string, int>>(@"{""Key"": ""123"","), "Unexpected end when reading JSON. Path 'Key', line 1, position 14.");
}
}
}
@@ -479,7 +479,7 @@ namespace Newtonsoft.Json.Tests.Serialization
PreserveReferencesHandling = PreserveReferencesHandling.All,
MetadataPropertyHandling = MetadataPropertyHandling.Default
});
}, @"Unexpected end when deserializing object. Path '$id', line 2, position 8.");
}, @"Unexpected end when reading JSON. Path '$id', line 2, position 8.");
}
public class CircularReferenceClassConverter : JsonConverter