-Code reformat
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Lib\NUnit\DotNet\nunit.framework.dll = Lib\NUnit\DotNet\nunit.framework.dll
|
||||
|
||||
@@ -47,6 +47,7 @@ using System.Globalization;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Bson
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -28,6 +28,7 @@ using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -169,7 +169,6 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}", json);
|
||||
|
||||
Assert.IsNotNull(deserializedDs);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -455,4 +454,5 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -303,4 +303,5 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -183,7 +183,6 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
Assert.AreEqual(null, c.Expando);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,6 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
// }
|
||||
|
||||
Console.WriteLine(jsonText);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,6 +220,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
public object Object1 { get; set; }
|
||||
public object Object2 { get; set; }
|
||||
|
||||
[JsonConverter(typeof(DateIntConverter))]
|
||||
public object ObjectNotHandled { get; set; }
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
|
||||
#if NETFX_CORE
|
||||
using System;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@@ -28,6 +28,7 @@ using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -43,6 +44,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
[JsonProperty("_id")]
|
||||
public BsonObjectId Id { get; set; }
|
||||
|
||||
[JsonProperty("test")]
|
||||
public string Test { get; set; }
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -39,10 +40,10 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
public VersionClass(string version1, string version2)
|
||||
{
|
||||
this.StringProperty1 = "StringProperty1";
|
||||
this.Version1 = new Version(version1);
|
||||
this.Version2 = new Version(version2);
|
||||
this.StringProperty2 = "StringProperty2";
|
||||
StringProperty1 = "StringProperty1";
|
||||
Version1 = new Version(version1);
|
||||
Version2 = new Version(version2);
|
||||
StringProperty2 = "StringProperty2";
|
||||
}
|
||||
|
||||
public VersionClass()
|
||||
|
||||
@@ -43,6 +43,7 @@ using Newtonsoft.Json.Utilities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NET20
|
||||
using System.Xml.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
@@ -524,10 +525,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"XmlNodeConverter can only convert JSON that begins with an object.",
|
||||
() =>
|
||||
{
|
||||
XmlDocument newDoc = (XmlDocument)JsonConvert.DeserializeXmlNode(@"[1]");
|
||||
});
|
||||
() => { XmlDocument newDoc = (XmlDocument)JsonConvert.DeserializeXmlNode(@"[1]"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -535,10 +533,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName.",
|
||||
() =>
|
||||
{
|
||||
XmlDocument newDoc = (XmlDocument)JsonConvert.DeserializeXmlNode(@"{Prop1:1,Prop2:2}");
|
||||
});
|
||||
() => { XmlDocument newDoc = (XmlDocument)JsonConvert.DeserializeXmlNode(@"{Prop1:1,Prop2:2}"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -656,10 +651,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.DeserializeXmlNode(json);
|
||||
});
|
||||
() => { JsonConvert.DeserializeXmlNode(json); });
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
@@ -670,10 +662,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.DeserializeXNode(json);
|
||||
});
|
||||
() => { JsonConvert.DeserializeXNode(json); });
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1136,10 +1125,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"XmlNodeConverter cannot convert JSON with an empty property name to XML.",
|
||||
() =>
|
||||
{
|
||||
DeserializeXmlNode(json);
|
||||
});
|
||||
() => { DeserializeXmlNode(json); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1925,4 +1911,5 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -170,8 +170,8 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
""Name"": ""Mike Manager""
|
||||
}
|
||||
]", json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -177,7 +177,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -181,4 +181,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -319,7 +319,8 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
|
||||
var categories =
|
||||
from c in rss["channel"]["item"].Children()["category"].Values<string>()
|
||||
group c by c into g
|
||||
group c by c
|
||||
into g
|
||||
orderby g.Count() descending
|
||||
select new { Category = g.Key, Count = g.Count() };
|
||||
|
||||
@@ -457,4 +458,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -218,4 +218,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -147,4 +147,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -54,7 +54,8 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
|
||||
|
||||
var categories =
|
||||
from c in rss["channel"]["item"].Children()["category"].Values<string>()
|
||||
group c by c into g
|
||||
group c by c
|
||||
into g
|
||||
orderby g.Count() descending
|
||||
select new { Category = g.Key, Count = g.Count() };
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
public class DynamicContractResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly char _startingWithChar;
|
||||
|
||||
public DynamicContractResolver(char startingWithChar)
|
||||
{
|
||||
_startingWithChar = startingWithChar;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public int Size { get; set; }
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Age { get; set; }
|
||||
|
||||
public List<string> Roles
|
||||
{
|
||||
get
|
||||
@@ -27,6 +28,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
}
|
||||
set { _roles = value; }
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
[OnError]
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
|
||||
[JsonProperty]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public int Size { get; set; }
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
// appear last
|
||||
[JsonProperty(Order = 1)]
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
[JsonProperty(Order = 2)]
|
||||
public DateTime DeletedDate { get; set; }
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
{
|
||||
public string FullName { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string PasswordHash { get; set; }
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Age { get; set; }
|
||||
|
||||
public List<string> Roles
|
||||
{
|
||||
get
|
||||
@@ -282,6 +283,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
set { _roles = value; }
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
[OnError]
|
||||
@@ -624,6 +626,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
// included in JSON
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public decimal SalePrice { get; set; }
|
||||
|
||||
@@ -692,6 +695,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
// customize default values
|
||||
[DefaultValue(30)]
|
||||
public int FollowUpDays { get; set; }
|
||||
|
||||
[DefaultValue("")]
|
||||
public string FollowUpEmailAddress { get; set; }
|
||||
}
|
||||
@@ -738,6 +742,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
public class DynamicContractResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly char _startingWithChar;
|
||||
|
||||
public DynamicContractResolver(char startingWithChar)
|
||||
{
|
||||
_startingWithChar = startingWithChar;
|
||||
@@ -908,4 +913,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -171,4 +171,5 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -40,6 +40,7 @@ using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -405,10 +406,7 @@ now brown cow?", '"', true);
|
||||
public void ToStringInvalid()
|
||||
{
|
||||
ExceptionAssert.Throws<ArgumentException>("Unsupported type: System.Version. Use the JsonSerializer class to get the object's JSON representation.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.ToString(new Version(1, 0));
|
||||
});
|
||||
() => { JsonConvert.ToString(new Version(1, 0)); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -67,10 +67,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>("Unexpected content while parsing JSON. Path 'u', line 1, position 27.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -407,10 +404,7 @@ Nice froob armor.. but ugleh!
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Additional text encountered after finished reading JSON content: c. Path '', line 5, position 2.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -661,10 +655,7 @@ Nice froob armor.. but ugleh!
|
||||
ExceptionAssert.Throws<ArgumentNullException>(
|
||||
@"Value cannot be null.
|
||||
Parameter name: reader",
|
||||
() =>
|
||||
{
|
||||
new JsonTextReader(null);
|
||||
});
|
||||
() => { new JsonTextReader(null); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -674,10 +665,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unterminated string. Expected delimiter: '. Path '', line 1, position 3.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -935,10 +923,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end while parsing unicode character. Path '', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -948,10 +933,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unterminated string. Expected delimiter: '. Path '', line 1, position 3.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -961,10 +943,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading bytes. Unexpected token: Boolean. Path '', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -977,10 +956,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unterminated string. Expected delimiter: '. Path '', line 1, position 17.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1001,10 +977,7 @@ Parameter name: reader",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end while parsing unquoted property name. Path '', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1230,7 +1203,6 @@ bye", reader.Value);
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
while (reader.Read())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1526,10 +1498,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
@"Invalid character after parsing property name. Expected ':' but got: "". Path 'A', line 3, position 9.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1641,10 +1610,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected character encountered while parsing value: }. Path '', line 1, position 1.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1672,10 +1638,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end when reading bytes. Path '', line 1, position 1.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
@@ -1696,10 +1659,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading decimal. Unexpected token: StartConstructor. Path '', line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDecimal();
|
||||
});
|
||||
() => { reader.ReadAsDecimal(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1709,10 +1669,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading bytes. Unexpected token: StartConstructor. Path '', line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
@@ -1723,10 +1680,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading date. Unexpected token: StartConstructor. Path '', line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDateTimeOffset();
|
||||
});
|
||||
() => { reader.ReadAsDateTimeOffset(); });
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1748,10 +1702,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end when reading bytes. Path '[0]', line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1761,10 +1712,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected token when reading bytes: Float. Path '[0]', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsBytes();
|
||||
});
|
||||
() => { reader.ReadAsBytes(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1875,10 +1823,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Could not convert string to DateTimeOffset: blablahbla. Path 'Offset', line 1, position 22.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDateTimeOffset();
|
||||
});
|
||||
() => { reader.ReadAsDateTimeOffset(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2032,10 +1977,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<FormatException>(
|
||||
"Input string was not in a correct format.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsInt32();
|
||||
});
|
||||
() => { reader.ReadAsInt32(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2045,10 +1987,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error parsing null value. Path '', line 0, position 0.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2058,10 +1997,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error parsing null value. Path '', line 0, position 0.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2071,10 +2007,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error parsing null value. Path '', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2084,10 +2017,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end while parsing comment. Path '', line 1, position 6.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2097,10 +2027,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error parsing comment. Expected: *, got s. Path '', line 1, position 1.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2286,10 +2213,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end while parsing constructor. Path '', line 1, position 7.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2300,10 +2224,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected character while parsing constructor: !. Path '', line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2351,10 +2272,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error parsing boolean value. Path '', line 1, position 4.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2378,10 +2296,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected character while parsing constructor: ,. Path '', line 1, position 8.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
() => { Assert.IsTrue(reader.Read()); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2544,10 +2459,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Additional text encountered after finished reading JSON content: }. Path '', line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
reader.Read();
|
||||
});
|
||||
() => { reader.Read(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2632,10 +2544,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"The reader's MaxDepth of 1 has been exceeded. Path '[0]', line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
() => { Assert.IsTrue(reader.Read()); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2653,10 +2562,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"The reader's MaxDepth of 1 has been exceeded. Path '[0]', line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
() => { Assert.IsTrue(reader.Read()); });
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
@@ -2676,10 +2582,7 @@ bye", reader.Value);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"The reader's MaxDepth of 1 has been exceeded. Path '[1]', line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
() => { Assert.IsTrue(reader.Read()); });
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
@@ -2928,14 +2831,14 @@ bye", reader.Value);
|
||||
|
||||
public class SlowStream : Stream
|
||||
{
|
||||
byte[] bytes;
|
||||
int totalBytesRead;
|
||||
int bytesPerRead;
|
||||
private byte[] bytes;
|
||||
private int totalBytesRead;
|
||||
private int bytesPerRead;
|
||||
|
||||
public SlowStream(byte[] content, int bytesPerRead)
|
||||
{
|
||||
this.bytes = content;
|
||||
this.totalBytesRead = 0;
|
||||
bytes = content;
|
||||
totalBytesRead = 0;
|
||||
this.bytesPerRead = bytesPerRead;
|
||||
}
|
||||
|
||||
@@ -2976,14 +2879,14 @@ bye", reader.Value);
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int toReturn = Math.Min(count, this.bytesPerRead);
|
||||
toReturn = Math.Min(toReturn, this.bytes.Length - this.totalBytesRead);
|
||||
int toReturn = Math.Min(count, bytesPerRead);
|
||||
toReturn = Math.Min(toReturn, bytes.Length - totalBytesRead);
|
||||
if (toReturn > 0)
|
||||
{
|
||||
Array.Copy(this.bytes, this.totalBytesRead, buffer, offset, toReturn);
|
||||
Array.Copy(bytes, totalBytesRead, buffer, offset, toReturn);
|
||||
}
|
||||
|
||||
this.totalBytesRead += toReturn;
|
||||
totalBytesRead += toReturn;
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -1578,10 +1578,7 @@ namespace Newtonsoft.Json.Tests
|
||||
IList<ValidationEventArgs> validationEventArgs = new List<ValidationEventArgs>();
|
||||
|
||||
JsonValidatingReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(json)));
|
||||
reader.ValidationEventHandler += (sender, args) =>
|
||||
{
|
||||
validationEventArgs.Add(args);
|
||||
};
|
||||
reader.ValidationEventHandler += (sender, args) => { validationEventArgs.Add(args); };
|
||||
reader.Schema = JsonSchema.Parse(schema);
|
||||
|
||||
while (reader.Read())
|
||||
|
||||
@@ -72,4 +72,5 @@ namespace Newtonsoft.Json.Tests.Linq.ComponentModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -84,4 +84,5 @@ namespace Newtonsoft.Json.Tests.Linq.ComponentModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -846,4 +846,5 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -38,6 +38,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
@@ -119,7 +120,6 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(3, (int)a[3]);
|
||||
|
||||
Assert.AreEqual(null, a[4]);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -130,10 +130,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
ExceptionAssert.Throws<ArgumentNullException>(
|
||||
@"Value cannot be null.
|
||||
Parameter name: array",
|
||||
() =>
|
||||
{
|
||||
((ICollection<JToken>) j).CopyTo(null, 0);
|
||||
});
|
||||
() => { ((ICollection<JToken>)j).CopyTo(null, 0); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -144,10 +141,7 @@ Parameter name: array",
|
||||
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
|
||||
@"arrayIndex is less than 0.
|
||||
Parameter name: arrayIndex",
|
||||
() =>
|
||||
{
|
||||
((ICollection<JToken>) j).CopyTo(new JToken[1], -1);
|
||||
});
|
||||
() => { ((ICollection<JToken>)j).CopyTo(new JToken[1], -1); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -157,10 +151,7 @@ Parameter name: arrayIndex",
|
||||
|
||||
ExceptionAssert.Throws<ArgumentException>(
|
||||
@"arrayIndex is equal to or greater than the length of array.",
|
||||
() =>
|
||||
{
|
||||
((ICollection<JToken>) j).CopyTo(new JToken[1], 1);
|
||||
});
|
||||
() => { ((ICollection<JToken>)j).CopyTo(new JToken[1], 1); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -173,10 +164,7 @@ Parameter name: arrayIndex",
|
||||
|
||||
ExceptionAssert.Throws<ArgumentException>(
|
||||
@"The number of elements in the source JObject is greater than the available space from arrayIndex to the end of the destination array.",
|
||||
() =>
|
||||
{
|
||||
((ICollection<JToken>)j).CopyTo(new JToken[3], 1);
|
||||
});
|
||||
() => { ((ICollection<JToken>)j).CopyTo(new JToken[3], 1); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -255,10 +243,7 @@ Parameter name: arrayIndex",
|
||||
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
|
||||
@"Index is equal to or greater than Count.
|
||||
Parameter name: index",
|
||||
() =>
|
||||
{
|
||||
j.RemoveAt(0);
|
||||
});
|
||||
() => { j.RemoveAt(0); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -269,10 +254,7 @@ Parameter name: index",
|
||||
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
|
||||
@"Index is less than 0.
|
||||
Parameter name: index",
|
||||
() =>
|
||||
{
|
||||
j.RemoveAt(-1);
|
||||
});
|
||||
() => { j.RemoveAt(-1); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -353,10 +335,7 @@ Parameter name: index",
|
||||
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
|
||||
@"Index was out of range. Must be non-negative and less than the size of the collection.
|
||||
Parameter name: index",
|
||||
() =>
|
||||
{
|
||||
j.Insert(-1, new JValue(1));
|
||||
});
|
||||
() => { j.Insert(-1, new JValue(1)); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -367,10 +346,7 @@ Parameter name: index",
|
||||
ExceptionAssert.Throws<ArgumentOutOfRangeException>(
|
||||
@"Index must be within the bounds of the List.
|
||||
Parameter name: index",
|
||||
() =>
|
||||
{
|
||||
j.Insert(2, new JValue(1));
|
||||
});
|
||||
() => { j.Insert(2, new JValue(1)); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -402,10 +378,7 @@ Parameter name: index",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path '', line 1, position 1.",
|
||||
() =>
|
||||
{
|
||||
JArray.Parse(json);
|
||||
});
|
||||
() => { JArray.Parse(json); });
|
||||
}
|
||||
|
||||
public class ListItemFields
|
||||
@@ -547,10 +520,7 @@ Parameter name: index",
|
||||
{
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Unexpected end of content while loading JArray. Path '[0]', line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
JArray.Parse("[1");
|
||||
});
|
||||
() => { JArray.Parse("[1"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -576,10 +546,7 @@ Parameter name: index",
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Additional text encountered after finished reading JSON content: ,. Path '', line 5, position 2.",
|
||||
() =>
|
||||
{
|
||||
JArray.Parse(json);
|
||||
});
|
||||
() => { JArray.Parse(json); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -38,6 +38,7 @@ using System.IO;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
@@ -442,13 +442,10 @@ Parameter name: arrayIndex",
|
||||
{
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Invalid property identifier character: ]. Path 'name', line 3, position 5.",
|
||||
() =>
|
||||
{
|
||||
JObject.Parse(@"{
|
||||
() => { JObject.Parse(@"{
|
||||
""name"": ""James"",
|
||||
]!#$THIS IS: BAD JSON![{}}}}]
|
||||
}");
|
||||
});
|
||||
}"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1637,10 +1634,7 @@ Parameter name: arrayIndex",
|
||||
public void ParseIncomplete()
|
||||
{
|
||||
ExceptionAssert.Throws<Exception>("Unexpected end of content while loading JObject. Path 'foo', line 1, position 6.",
|
||||
() =>
|
||||
{
|
||||
JObject.Parse("{ foo:");
|
||||
});
|
||||
() => { JObject.Parse("{ foo:"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -37,6 +37,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
@@ -88,10 +89,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
@"Unexpected character while parsing path indexer: [",
|
||||
() =>
|
||||
{
|
||||
new JPath("Blah[[0]].Two.Three[1].Four");
|
||||
});
|
||||
() => { new JPath("Blah[[0]].Two.Three[1].Four"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -99,10 +97,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
@"Path ended with open indexer. Expected ]",
|
||||
() =>
|
||||
{
|
||||
new JPath("Blah[0");
|
||||
});
|
||||
() => { new JPath("Blah[0"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -131,10 +126,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Empty path indexer.",
|
||||
() =>
|
||||
{
|
||||
new JPath("[]");
|
||||
});
|
||||
() => { new JPath("[]"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -142,10 +134,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Unexpected character while parsing path: ]",
|
||||
() =>
|
||||
{
|
||||
new JPath("]");
|
||||
});
|
||||
() => { new JPath("]"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -164,10 +153,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Unexpected character following indexer: B",
|
||||
() =>
|
||||
{
|
||||
new JPath("[1]Blah");
|
||||
});
|
||||
() => { new JPath("[1]Blah"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -210,10 +196,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
@"Index 1 not valid on JObject.",
|
||||
() =>
|
||||
{
|
||||
o.SelectToken("[1]", true);
|
||||
});
|
||||
() => { o.SelectToken("[1]", true); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -232,10 +215,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
@"Property 'BlahBlah' not valid on JArray.",
|
||||
() =>
|
||||
{
|
||||
a.SelectToken("BlahBlah", true);
|
||||
});
|
||||
() => { a.SelectToken("BlahBlah", true); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -245,10 +225,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
@"Index 1 outside the bounds of JConstructor.",
|
||||
() =>
|
||||
{
|
||||
c.SelectToken("[1]", true);
|
||||
});
|
||||
() => { c.SelectToken("[1]", true); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -259,10 +236,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Property 'Missing' does not exist on JObject.",
|
||||
() =>
|
||||
{
|
||||
o.SelectToken("Missing", true);
|
||||
});
|
||||
() => { o.SelectToken("Missing", true); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -281,10 +255,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Index 1000 outside the bounds of JArray.",
|
||||
() =>
|
||||
{
|
||||
a.SelectToken("[1000].Ha", true);
|
||||
});
|
||||
() => { a.SelectToken("[1000].Ha", true); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -96,10 +96,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Cannot add or remove items from Newtonsoft.Json.Linq.JProperty.",
|
||||
() =>
|
||||
{
|
||||
l.Clear();
|
||||
});
|
||||
() => { l.Clear(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -110,10 +107,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Newtonsoft.Json.Linq.JProperty cannot have multiple values.",
|
||||
() =>
|
||||
{
|
||||
l.Add(null);
|
||||
});
|
||||
() => { l.Add(null); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -124,10 +118,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Cannot add or remove items from Newtonsoft.Json.Linq.JProperty.",
|
||||
() =>
|
||||
{
|
||||
l.Remove(p.Value);
|
||||
});
|
||||
() => { l.Remove(p.Value); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -176,10 +167,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
"Newtonsoft.Json.Linq.JProperty cannot have multiple values.",
|
||||
() =>
|
||||
{
|
||||
t.Add(1);
|
||||
});
|
||||
() => { t.Add(1); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,10 +139,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Could not convert string to DateTimeOffset: blablahbla. Path 'Offset', line 1, position 22.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDateTimeOffset();
|
||||
});
|
||||
() => { reader.ReadAsDateTimeOffset(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -162,10 +159,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading date. Unexpected token: Boolean. Path 'Offset', line 1, position 14.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDateTimeOffset();
|
||||
});
|
||||
() => { reader.ReadAsDateTimeOffset(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -497,10 +491,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Could not convert string to integer: hi. Path 'Name', line 1, position 12.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsInt32();
|
||||
});
|
||||
() => { reader.ReadAsInt32(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -520,10 +511,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading integer. Unexpected token: Boolean. Path 'Name', line 1, position 12.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsInt32();
|
||||
});
|
||||
() => { reader.ReadAsInt32(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -564,10 +552,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Could not convert string to decimal: blah. Path 'Name', line 1, position 14.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDecimal();
|
||||
});
|
||||
() => { reader.ReadAsDecimal(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -587,10 +572,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"Error reading decimal. Unexpected token: Boolean. Path 'Name', line 1, position 12.",
|
||||
() =>
|
||||
{
|
||||
reader.ReadAsDecimal();
|
||||
});
|
||||
() => { reader.ReadAsDecimal(); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -44,6 +44,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
@@ -43,6 +43,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
@@ -483,7 +483,8 @@ keyword such as type of business.""
|
||||
|
||||
var categories =
|
||||
from c in rss["channel"]["item"].Children()["category"].Values<string>()
|
||||
group c by c into g
|
||||
group c by c
|
||||
into g
|
||||
orderby g.Count() descending
|
||||
select new { Category = g.Key, Count = g.Count() };
|
||||
|
||||
@@ -612,7 +613,8 @@ keyword such as type of business.""
|
||||
[Test]
|
||||
public void DateTimeOffset()
|
||||
{
|
||||
List<DateTimeOffset> testDates = new List<DateTimeOffset> {
|
||||
List<DateTimeOffset> testDates = new List<DateTimeOffset>
|
||||
{
|
||||
new DateTimeOffset(new DateTime(100, 1, 1, 1, 1, 1, DateTimeKind.Utc)),
|
||||
new DateTimeOffset(2000, 1, 1, 1, 1, 1, TimeSpan.Zero),
|
||||
new DateTimeOffset(2000, 1, 1, 1, 1, 1, TimeSpan.FromHours(13)),
|
||||
@@ -679,7 +681,8 @@ keyword such as type of business.""
|
||||
{ "title", "James Newton-King" },
|
||||
{ "link", "http://james.newtonking.com" },
|
||||
{ "description", "James Newton-King's blog." },
|
||||
{ "item",
|
||||
{
|
||||
"item",
|
||||
(from p in posts
|
||||
orderby p.Title
|
||||
select new
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
|
||||
{
|
||||
[JsonConverter(typeof(GuidByteArrayConverter))]
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public EntitySet<PersonRole> PersonRoles { get; set; }
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ namespace Newtonsoft.Json.Tests
|
||||
//private const int Iterations = 5000;
|
||||
|
||||
#region Data
|
||||
|
||||
private const string BsonHex =
|
||||
@"A9-01-00-00-04-73-74-72-69-6E-67-73-00-2B-00-00-00-0A-30-00-02-31-00-19-00-00-00-4D-61-72-6B-75-73-20-65-67-67-65-72-20-5D-3E-3C-5B-2C-20-28-32-6E-64-29-00-0A-32-00-00-03-64-69-63-74-69-6F-6E-61-72-79-00-37-00-00-00-10-56-61-6C-20-26-20-61-73-64-31-00-01-00-00-00-10-56-61-6C-32-20-26-20-61-73-64-31-00-03-00-00-00-10-56-61-6C-33-20-26-20-61-73-64-31-00-04-00-00-00-00-02-4E-61-6D-65-00-05-00-00-00-52-69-63-6B-00-09-4E-6F-77-00-EF-BD-69-EC-25-01-00-00-01-42-69-67-4E-75-6D-62-65-72-00-E7-7B-CC-26-96-C7-1F-42-03-41-64-64-72-65-73-73-31-00-47-00-00-00-02-53-74-72-65-65-74-00-0B-00-00-00-66-66-66-20-53-74-72-65-65-74-00-02-50-68-6F-6E-65-00-0F-00-00-00-28-35-30-33-29-20-38-31-34-2D-36-33-33-35-00-09-45-6E-74-65-72-65-64-00-6F-FF-31-53-26-01-00-00-00-04-41-64-64-72-65-73-73-65-73-00-A2-00-00-00-03-30-00-4B-00-00-00-02-53-74-72-65-65-74-00-0F-00-00-00-1F-61-72-72-61-79-3C-61-64-64-72-65-73-73-00-02-50-68-6F-6E-65-00-0F-00-00-00-28-35-30-33-29-20-38-31-34-2D-36-33-33-35-00-09-45-6E-74-65-72-65-64-00-6F-73-0C-E7-25-01-00-00-00-03-31-00-4C-00-00-00-02-53-74-72-65-65-74-00-10-00-00-00-61-72-72-61-79-20-32-20-61-64-64-72-65-73-73-00-02-50-68-6F-6E-65-00-0F-00-00-00-28-35-30-33-29-20-38-31-34-2D-36-33-33-35-00-09-45-6E-74-65-72-65-64-00-6F-17-E6-E1-25-01-00-00-00-00-00";
|
||||
|
||||
@@ -100,7 +99,6 @@ namespace Newtonsoft.Json.Tests
|
||||
DataContractSerializer,
|
||||
DataContractJsonSerializer
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[Test]
|
||||
@@ -451,7 +449,6 @@ If attributes are not mentioned, default values are used in each case.
|
||||
}
|
||||
|
||||
#region Serialize
|
||||
|
||||
private static readonly byte[] Buffer = new byte[4096];
|
||||
|
||||
public void BenchmarkSerializeMethod(SerializeMethod method, object value)
|
||||
@@ -700,11 +697,9 @@ If attributes are not mentioned, default values are used in each case.
|
||||
//json = BitConverter.ToString(ms.ToArray(), 0, (int)ms.Position);
|
||||
return json;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Deserialize
|
||||
|
||||
public void BenchmarkDeserializeMethod<T>(SerializeMethod method, object json)
|
||||
{
|
||||
Deserialize<T>(method, json);
|
||||
@@ -899,11 +894,8 @@ If attributes are not mentioned, default values are used in each case.
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
return (T)formatter.Deserialize(new MemoryStream(bytes));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void SerializeLargeObject()
|
||||
{
|
||||
@@ -1045,7 +1037,6 @@ If attributes are not mentioned, default values are used in each case.
|
||||
}
|
||||
|
||||
#region Classes
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class TestClass
|
||||
@@ -1087,7 +1078,6 @@ If attributes are not mentioned, default values are used in each case.
|
||||
private Address _Address1 = new Address();
|
||||
|
||||
|
||||
|
||||
[DataMember]
|
||||
public List<Address> Addresses
|
||||
{
|
||||
@@ -1097,9 +1087,11 @@ If attributes are not mentioned, default values are used in each case.
|
||||
|
||||
private List<Address> _Addresses = new List<Address>();
|
||||
|
||||
[DataMember] public List<string> strings = new List<string>();
|
||||
[DataMember]
|
||||
public List<string> strings = new List<string>();
|
||||
|
||||
[DataMember] public Dictionary<string, int> dictionary = new Dictionary<string, int>();
|
||||
[DataMember]
|
||||
public Dictionary<string, int> dictionary = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -1150,7 +1142,6 @@ If attributes are not mentioned, default values are used in each case.
|
||||
[DataMember]
|
||||
public int[] Scores { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ using System.Security;
|
||||
#elif NET40
|
||||
[assembly: AssemblyTitle("Json.NET Tests .NET 4.0")]
|
||||
#else
|
||||
|
||||
[assembly: AssemblyTitle("Json.NET Tests")]
|
||||
#endif
|
||||
|
||||
@@ -60,9 +61,11 @@ using System.Security;
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly: Guid("0be3d72b-d2ef-409c-985c-d3ede89a25f1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
@@ -74,5 +77,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.8.16617")]
|
||||
[assembly: AssemblyFileVersion("5.0.8.16620")]
|
||||
@@ -38,6 +38,7 @@ using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(SILVERLIGHT || NETFX_CORE)
|
||||
using System.Data;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
@@ -177,10 +178,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
List<string> errors = new List<string>();
|
||||
|
||||
token.Validate(typeSchema, (sender, args) =>
|
||||
{
|
||||
errors.Add(args.Message);
|
||||
});
|
||||
token.Validate(typeSchema, (sender, args) => { errors.Add(args.Message); });
|
||||
|
||||
if (errors.Count > 0)
|
||||
Assert.Fail("Schema generated for type '{0}' is not valid." + Environment.NewLine + string.Join(Environment.NewLine, errors.ToArray()), typeof(T));
|
||||
|
||||
@@ -47,6 +47,7 @@ using Extensions=Newtonsoft.Json.Schema.Extensions;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -116,6 +117,5 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
Assert.AreEqual(node, node.Items[0]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -275,7 +276,6 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}
|
||||
}
|
||||
}", json);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""BirthDate"": ""2000-11-20T23:55:44Z"",
|
||||
""LastModified"": ""2000-11-20T23:55:44Z""
|
||||
}", json);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -27,6 +27,7 @@ using System.Reflection;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public class DynamicContractResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly char _startingWithChar;
|
||||
|
||||
public DynamicContractResolver(char startingWithChar)
|
||||
: base(false)
|
||||
{
|
||||
|
||||
@@ -195,6 +195,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
[JsonProperty(PropertyName = "firstName")]
|
||||
public string Firstname { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "lastName")]
|
||||
public string Lastname { get; set; }
|
||||
|
||||
@@ -360,9 +361,12 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
[DefaultValue(1)]
|
||||
public int IntValue1 { get; set; }
|
||||
|
||||
public int IntValue2 { get; set; }
|
||||
|
||||
[DefaultValue(null)]
|
||||
public int IntValue3 { get; set; }
|
||||
|
||||
public DefaultValueHandlingDeserialize ClassValue { get; set; }
|
||||
}
|
||||
|
||||
@@ -380,6 +384,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
[DefaultValue(1)]
|
||||
public int IntValue1 { get; set; }
|
||||
|
||||
public int IntValue2 { get; set; }
|
||||
public DefaultValueHandlingDeserialize ClassValue { get; set; }
|
||||
}
|
||||
@@ -407,43 +412,61 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TimeSpan TimeSpan { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTimeOffset DateTimeOffset { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public decimal Decimal { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public int Integer { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public double Double { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public bool Boolean { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DefaultStruct Struct { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public StringComparison Enum { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid? NullableGuid { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TimeSpan? NullableTimeSpan { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? NullableDateTime { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTimeOffset? NullableDateTimeOffset { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public decimal? NullableDecimal { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public int? NullableInteger { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public double? NullableDouble { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public bool? NullableBoolean { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DefaultStruct? NullableStruct { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public StringComparison? NullableEnum { get; set; }
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -335,8 +336,10 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
private readonly Dictionary<string, object> _members;
|
||||
|
||||
public int Int;
|
||||
|
||||
[JsonProperty]
|
||||
public bool Explicit;
|
||||
|
||||
public DynamicChildObject ChildObject { get; set; }
|
||||
|
||||
internal Dictionary<string, object> Members
|
||||
@@ -395,4 +398,5 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -32,6 +32,7 @@ using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -318,4 +319,5 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -431,4 +431,5 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,7 @@ using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -64,10 +65,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
@"Could not find member 'Price' on object of type 'ProductShort'. Path 'Price', line 4, position 11.",
|
||||
() =>
|
||||
{
|
||||
ProductShort deserializedProductShort = (ProductShort)JsonConvert.DeserializeObject(output, typeof(ProductShort), new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error });
|
||||
});
|
||||
() => { ProductShort deserializedProductShort = (ProductShort)JsonConvert.DeserializeObject(output, typeof(ProductShort), new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error }); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -132,10 +130,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"Could not find member 'Missing' on object of type 'DoubleClass'. Path 'Missing', line 1, position 11.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.DeserializeObject<DoubleClass>(json, new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error });
|
||||
});
|
||||
() => { JsonConvert.DeserializeObject<DoubleClass>(json, new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error }); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -28,6 +28,7 @@ using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -29,6 +29,7 @@ using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -157,10 +158,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void PopulateWithBadJson()
|
||||
{
|
||||
ExceptionAssert.Throws<JsonSerializationException>("Unexpected initial token 'Integer' when populating object. Expected JSON object or array. Path '', line 1, position 1.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.PopulateObject("1", new Person());
|
||||
});
|
||||
() => { JsonConvert.PopulateObject("1", new Person()); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -106,10 +107,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
"Self referencing loop detected with type '" + classRef + "'. Path '[2][0]'.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.SerializeObject(circularList, Formatting.Indented);
|
||||
});
|
||||
() => { JsonConvert.SerializeObject(circularList, Formatting.Indented); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -266,10 +264,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
@"Self referencing loop detected with type '" + classRef + "'. Path ''.",
|
||||
() =>
|
||||
{
|
||||
JsonConvert.SerializeObject(circularDictionary, Formatting.Indented);
|
||||
});
|
||||
() => { JsonConvert.SerializeObject(circularDictionary, Formatting.Indented); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -759,7 +754,6 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public class User
|
||||
{
|
||||
#region properties
|
||||
|
||||
[JsonProperty(Required = Required.Always, PropertyName = "SecretType")]
|
||||
private string secretType;
|
||||
|
||||
@@ -774,27 +768,22 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
[JsonProperty]
|
||||
public User Friend { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region constructors
|
||||
|
||||
public User()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public User(string login, Type secretType)
|
||||
: this()
|
||||
{
|
||||
this.Login = login;
|
||||
this.SecretType = secretType;
|
||||
Login = login;
|
||||
SecretType = secretType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return SecretType.GetHashCode();
|
||||
@@ -804,7 +793,6 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
return string.Format("SecretType: {0}, Login: {1}", secretType, Login);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1113,8 +1101,10 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
public TestComponentSimple Component1 { get; set; }
|
||||
public TestComponentSimple Component2 { get; set; }
|
||||
|
||||
[JsonProperty(IsReference = false)]
|
||||
public TestComponentSimple ComponentNotReference { get; set; }
|
||||
|
||||
public string String { get; set; }
|
||||
public int Integer { get; set; }
|
||||
}
|
||||
|
||||
@@ -654,10 +654,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void WriteEndOnPropertyState()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Error += (obj, args) =>
|
||||
{
|
||||
args.ErrorContext.Handled = true;
|
||||
};
|
||||
settings.Error += (obj, args) => { args.ErrorContext.Handled = true; };
|
||||
|
||||
var data = new List<ErrorPerson2>()
|
||||
{
|
||||
@@ -675,10 +672,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void WriteEndOnPropertyState2()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Error += (obj, args) =>
|
||||
{
|
||||
args.ErrorContext.Handled = true;
|
||||
};
|
||||
settings.Error += (obj, args) => { args.ErrorContext.Handled = true; };
|
||||
|
||||
var data = new List<ErrorPerson2>
|
||||
{
|
||||
@@ -702,10 +696,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
MemoryStream stream = new MemoryStream(byteArray);
|
||||
JsonTextReader jReader = new JsonTextReader(new StreamReader(stream));
|
||||
JsonSerializer s = new JsonSerializer();
|
||||
s.Error += (sender, args) =>
|
||||
{
|
||||
args.ErrorContext.Handled = true;
|
||||
};
|
||||
s.Error += (sender, args) => { args.ErrorContext.Handled = true; };
|
||||
ErrorPerson2 obj = s.Deserialize<ErrorPerson2>(jReader);
|
||||
|
||||
Assert.IsNull(obj);
|
||||
@@ -722,19 +713,15 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
@"Unterminated string. Expected delimiter: "". Path '', line 1, position 3.",
|
||||
() =>
|
||||
() => { ErrorTestObject obj = s.Deserialize<ErrorTestObject>(jReader); });
|
||||
}
|
||||
}
|
||||
|
||||
internal interface IErrorPerson2
|
||||
{
|
||||
ErrorTestObject obj = s.Deserialize<ErrorTestObject>(jReader);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface IErrorPerson2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class ErrorPerson2//:IPerson - oops! Forgot to implement the person interface
|
||||
internal class ErrorPerson2 //:IPerson - oops! Forgot to implement the person interface
|
||||
{
|
||||
public string LastName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
@@ -799,8 +786,11 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[JsonObject]
|
||||
public class MyTypeWithRequiredMembers
|
||||
{
|
||||
[JsonProperty(Required = Required.AllowNull)] public string Required1;
|
||||
[JsonProperty(Required = Required.AllowNull)] public string Required2;
|
||||
[JsonProperty(Required = Required.AllowNull)]
|
||||
public string Required1;
|
||||
|
||||
[JsonProperty(Required = Required.AllowNull)]
|
||||
public string Required2;
|
||||
}
|
||||
|
||||
public class LogMessage
|
||||
|
||||
@@ -338,6 +338,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Debug.Assert(foo.Identifier == 25);
|
||||
}
|
||||
#endif
|
||||
|
||||
public class FooEvent
|
||||
{
|
||||
public int Identifier { get; set; }
|
||||
@@ -345,7 +346,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[OnError]
|
||||
private void OnError(StreamingContext context, ErrorContext error)
|
||||
{
|
||||
this.Identifier = 25;
|
||||
Identifier = 25;
|
||||
|
||||
// Here we could for example manually copy the
|
||||
// persisted "Id" value into the renamed "Identifier"
|
||||
|
||||
@@ -23,6 +23,7 @@ using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -996,9 +996,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
//Test Json Serialization
|
||||
//This fails because the JsonSerializer doesn't serialize type names correctly for ISerializable objects
|
||||
//Type Names should be serialized for All, Auto and Object modes
|
||||
this.TestJsonSerializationRoundTrip(w, TypeNameHandling.All);
|
||||
this.TestJsonSerializationRoundTrip(w, TypeNameHandling.Auto);
|
||||
this.TestJsonSerializationRoundTrip(w, TypeNameHandling.Objects);
|
||||
TestJsonSerializationRoundTrip(w, TypeNameHandling.All);
|
||||
TestJsonSerializationRoundTrip(w, TypeNameHandling.Auto);
|
||||
TestJsonSerializationRoundTrip(w, TypeNameHandling.Objects);
|
||||
}
|
||||
|
||||
private void TestJsonSerializationRoundTrip(SerializableWrapper e, TypeNameHandling flag)
|
||||
@@ -1750,10 +1750,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public interface IExample
|
||||
: ISerializable
|
||||
{
|
||||
String Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
String Name { get; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -1762,17 +1759,17 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
public Example(String name)
|
||||
{
|
||||
this.Name = name;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
protected Example(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
this.Name = info.GetString("name");
|
||||
Name = info.GetString("name");
|
||||
}
|
||||
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
info.AddValue("name", this.Name);
|
||||
info.AddValue("name", Name);
|
||||
}
|
||||
|
||||
public String Name { get; set; }
|
||||
@@ -1783,7 +1780,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj is IExample)
|
||||
{
|
||||
return this.Name.Equals(((IExample)obj).Name);
|
||||
return Name.Equals(((IExample)obj).Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1850,10 +1847,13 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
public object Object1 { get; set; }
|
||||
public object Object2 { get; set; }
|
||||
|
||||
[JsonProperty(TypeNameHandling = TypeNameHandling.None)]
|
||||
public object ObjectNotHandled { get; set; }
|
||||
|
||||
public string String { get; set; }
|
||||
public int Integer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -123,7 +123,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
public SerializableType(string protectedFieldValue)
|
||||
{
|
||||
this.protectedField = protectedFieldValue;
|
||||
protectedField = protectedFieldValue;
|
||||
}
|
||||
|
||||
public string publicField;
|
||||
@@ -134,14 +134,8 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
public string PublicProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return privateField;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.privateField = value;
|
||||
}
|
||||
get { return privateField; }
|
||||
set { privateField = value; }
|
||||
}
|
||||
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
@@ -153,11 +147,11 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
public bool Equals(SerializableType other)
|
||||
{
|
||||
return this.publicField == other.publicField &&
|
||||
this.internalField == other.internalField &&
|
||||
this.protectedInternalField == other.protectedInternalField &&
|
||||
this.protectedField == other.protectedField &&
|
||||
this.privateField == other.privateField;
|
||||
return publicField == other.publicField &&
|
||||
internalField == other.internalField &&
|
||||
protectedInternalField == other.protectedInternalField &&
|
||||
protectedField == other.protectedField &&
|
||||
privateField == other.privateField;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.Reflection;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
|
||||
@@ -48,6 +48,7 @@ using System.Collections;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CircularReferenceClass Child { get; set; }
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[JsonProperty(Required = Required.AllowNull)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public CircularReferenceWithIdClass Child { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class ClassAndMemberConverterClass
|
||||
{
|
||||
public ConverterPrecedenceClass DefaultConverter { get; set; }
|
||||
|
||||
[JsonConverter(typeof(MemberConverterPrecedenceClassConverter))]
|
||||
public ConverterPrecedenceClass MemberConverter { get; set; }
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#if !NET20
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[DataContract]
|
||||
@@ -35,6 +36,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
// included in JSON
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public decimal SalePrice { get; set; }
|
||||
|
||||
@@ -45,4 +47,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public DateTime NextShipmentDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
this.param1 = param1;
|
||||
this.Param1 = Param1;
|
||||
this.Param2 = param2;
|
||||
Param2 = param2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[JsonProperty]
|
||||
public List<Content> Children;
|
||||
|
||||
[JsonProperty]
|
||||
public string Text;
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
public class ContentSubClass : ContentBaseClass
|
||||
{
|
||||
public ContentSubClass() { }
|
||||
public ContentSubClass()
|
||||
{
|
||||
}
|
||||
|
||||
public ContentSubClass(string EasyIn)
|
||||
{
|
||||
SomeString = EasyIn;
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
|
||||
public partial class CustomerDataSet : global::System.Data.DataSet
|
||||
{
|
||||
|
||||
private CustomersDataTable tableCustomers;
|
||||
|
||||
private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
|
||||
@@ -50,12 +49,12 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomerDataSet()
|
||||
{
|
||||
this.BeginInit();
|
||||
this.InitClass();
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
|
||||
BeginInit();
|
||||
InitClass();
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(SchemaChanged);
|
||||
base.Tables.CollectionChanged += schemaChangedHandler;
|
||||
base.Relations.CollectionChanged += schemaChangedHandler;
|
||||
this.EndInit();
|
||||
EndInit();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -63,16 +62,16 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected CustomerDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
|
||||
base(info, context, false)
|
||||
{
|
||||
if ((this.IsBinarySerialized(info, context) == true))
|
||||
if ((IsBinarySerialized(info, context) == true))
|
||||
{
|
||||
this.InitVars(false);
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
|
||||
this.Tables.CollectionChanged += schemaChangedHandler1;
|
||||
this.Relations.CollectionChanged += schemaChangedHandler1;
|
||||
InitVars(false);
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(SchemaChanged);
|
||||
Tables.CollectionChanged += schemaChangedHandler1;
|
||||
Relations.CollectionChanged += schemaChangedHandler1;
|
||||
return;
|
||||
}
|
||||
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
|
||||
if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema))
|
||||
if ((DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema))
|
||||
{
|
||||
global::System.Data.DataSet ds = new global::System.Data.DataSet();
|
||||
ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
|
||||
@@ -80,23 +79,23 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
base.Tables.Add(new CustomersDataTable(ds.Tables["Customers"]));
|
||||
}
|
||||
this.DataSetName = ds.DataSetName;
|
||||
this.Prefix = ds.Prefix;
|
||||
this.Namespace = ds.Namespace;
|
||||
this.Locale = ds.Locale;
|
||||
this.CaseSensitive = ds.CaseSensitive;
|
||||
this.EnforceConstraints = ds.EnforceConstraints;
|
||||
this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
|
||||
this.InitVars();
|
||||
DataSetName = ds.DataSetName;
|
||||
Prefix = ds.Prefix;
|
||||
Namespace = ds.Namespace;
|
||||
Locale = ds.Locale;
|
||||
CaseSensitive = ds.CaseSensitive;
|
||||
EnforceConstraints = ds.EnforceConstraints;
|
||||
Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
|
||||
InitVars();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
|
||||
ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
|
||||
}
|
||||
this.GetSerializationData(info, context);
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
|
||||
GetSerializationData(info, context);
|
||||
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(SchemaChanged);
|
||||
base.Tables.CollectionChanged += schemaChangedHandler;
|
||||
this.Relations.CollectionChanged += schemaChangedHandler;
|
||||
Relations.CollectionChanged += schemaChangedHandler;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -105,10 +104,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
|
||||
public CustomersDataTable Customers
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.tableCustomers;
|
||||
}
|
||||
get { return tableCustomers; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -117,14 +113,8 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
|
||||
public override global::System.Data.SchemaSerializationMode SchemaSerializationMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._schemaSerializationMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._schemaSerializationMode = value;
|
||||
}
|
||||
get { return _schemaSerializationMode; }
|
||||
set { _schemaSerializationMode = value; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -132,10 +122,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
|
||||
public new global::System.Data.DataTableCollection Tables
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Tables;
|
||||
}
|
||||
get { return base.Tables; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -143,19 +130,16 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
|
||||
public new global::System.Data.DataRelationCollection Relations
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Relations;
|
||||
}
|
||||
get { return base.Relations; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
protected override void InitializeDerivedDataSet()
|
||||
{
|
||||
this.BeginInit();
|
||||
this.InitClass();
|
||||
this.EndInit();
|
||||
BeginInit();
|
||||
InitClass();
|
||||
EndInit();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -164,7 +148,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
CustomerDataSet cln = ((CustomerDataSet)(base.Clone()));
|
||||
cln.InitVars();
|
||||
cln.SchemaSerializationMode = this.SchemaSerializationMode;
|
||||
cln.SchemaSerializationMode = SchemaSerializationMode;
|
||||
return cln;
|
||||
}
|
||||
|
||||
@@ -186,28 +170,28 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader)
|
||||
{
|
||||
if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema))
|
||||
if ((DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema))
|
||||
{
|
||||
this.Reset();
|
||||
Reset();
|
||||
global::System.Data.DataSet ds = new global::System.Data.DataSet();
|
||||
ds.ReadXml(reader);
|
||||
if ((ds.Tables["Customers"] != null))
|
||||
{
|
||||
base.Tables.Add(new CustomersDataTable(ds.Tables["Customers"]));
|
||||
}
|
||||
this.DataSetName = ds.DataSetName;
|
||||
this.Prefix = ds.Prefix;
|
||||
this.Namespace = ds.Namespace;
|
||||
this.Locale = ds.Locale;
|
||||
this.CaseSensitive = ds.CaseSensitive;
|
||||
this.EnforceConstraints = ds.EnforceConstraints;
|
||||
this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
|
||||
this.InitVars();
|
||||
DataSetName = ds.DataSetName;
|
||||
Prefix = ds.Prefix;
|
||||
Namespace = ds.Namespace;
|
||||
Locale = ds.Locale;
|
||||
CaseSensitive = ds.CaseSensitive;
|
||||
EnforceConstraints = ds.EnforceConstraints;
|
||||
Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
|
||||
InitVars();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ReadXml(reader);
|
||||
this.InitVars();
|
||||
ReadXml(reader);
|
||||
InitVars();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +200,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable()
|
||||
{
|
||||
global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
|
||||
this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
|
||||
WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
|
||||
stream.Position = 0;
|
||||
return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null);
|
||||
}
|
||||
@@ -225,19 +209,19 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
internal void InitVars()
|
||||
{
|
||||
this.InitVars(true);
|
||||
InitVars(true);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
internal void InitVars(bool initTable)
|
||||
{
|
||||
this.tableCustomers = ((CustomersDataTable)(base.Tables["Customers"]));
|
||||
tableCustomers = ((CustomersDataTable)(base.Tables["Customers"]));
|
||||
if ((initTable == true))
|
||||
{
|
||||
if ((this.tableCustomers != null))
|
||||
if ((tableCustomers != null))
|
||||
{
|
||||
this.tableCustomers.InitVars();
|
||||
tableCustomers.InitVars();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,12 +230,12 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
private void InitClass()
|
||||
{
|
||||
this.DataSetName = "CustomerDataSet";
|
||||
this.Prefix = "";
|
||||
this.EnforceConstraints = true;
|
||||
this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
|
||||
this.tableCustomers = new CustomersDataTable();
|
||||
base.Tables.Add(this.tableCustomers);
|
||||
DataSetName = "CustomerDataSet";
|
||||
Prefix = "";
|
||||
EnforceConstraints = true;
|
||||
SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
|
||||
tableCustomers = new CustomersDataTable();
|
||||
base.Tables.Add(tableCustomers);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -267,7 +251,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove))
|
||||
{
|
||||
this.InitVars();
|
||||
InitVars();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,38 +322,37 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
|
||||
public partial class CustomersDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable
|
||||
{
|
||||
|
||||
private global::System.Data.DataColumn columnCustomerID;
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersDataTable()
|
||||
{
|
||||
this.TableName = "Customers";
|
||||
this.BeginInit();
|
||||
this.InitClass();
|
||||
this.EndInit();
|
||||
TableName = "Customers";
|
||||
BeginInit();
|
||||
InitClass();
|
||||
EndInit();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
internal CustomersDataTable(global::System.Data.DataTable table)
|
||||
{
|
||||
this.TableName = table.TableName;
|
||||
TableName = table.TableName;
|
||||
if ((table.CaseSensitive != table.DataSet.CaseSensitive))
|
||||
{
|
||||
this.CaseSensitive = table.CaseSensitive;
|
||||
CaseSensitive = table.CaseSensitive;
|
||||
}
|
||||
if ((table.Locale.ToString() != table.DataSet.Locale.ToString()))
|
||||
{
|
||||
this.Locale = table.Locale;
|
||||
Locale = table.Locale;
|
||||
}
|
||||
if ((table.Namespace != table.DataSet.Namespace))
|
||||
{
|
||||
this.Namespace = table.Namespace;
|
||||
Namespace = table.Namespace;
|
||||
}
|
||||
this.Prefix = table.Prefix;
|
||||
this.MinimumCapacity = table.MinimumCapacity;
|
||||
Prefix = table.Prefix;
|
||||
MinimumCapacity = table.MinimumCapacity;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -377,17 +360,14 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected CustomersDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
|
||||
base(info, context)
|
||||
{
|
||||
this.InitVars();
|
||||
InitVars();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public global::System.Data.DataColumn CustomerIDColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.columnCustomerID;
|
||||
}
|
||||
get { return columnCustomerID; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -395,20 +375,14 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.ComponentModel.Browsable(false)]
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Rows.Count;
|
||||
}
|
||||
get { return Rows.Count; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersRow this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((CustomersRow)(this.Rows[index]));
|
||||
}
|
||||
get { return ((CustomersRow)(Rows[index])); }
|
||||
}
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
@@ -427,18 +401,20 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public void AddCustomersRow(CustomersRow row)
|
||||
{
|
||||
this.Rows.Add(row);
|
||||
Rows.Add(row);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersRow AddCustomersRow(string CustomerID)
|
||||
{
|
||||
CustomersRow rowCustomersRow = ((CustomersRow)(this.NewRow()));
|
||||
object[] columnValuesArray = new object[] {
|
||||
CustomerID};
|
||||
CustomersRow rowCustomersRow = ((CustomersRow)(NewRow()));
|
||||
object[] columnValuesArray = new object[]
|
||||
{
|
||||
CustomerID
|
||||
};
|
||||
rowCustomersRow.ItemArray = columnValuesArray;
|
||||
this.Rows.Add(rowCustomersRow);
|
||||
Rows.Add(rowCustomersRow);
|
||||
return rowCustomersRow;
|
||||
}
|
||||
|
||||
@@ -446,7 +422,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public virtual global::System.Collections.IEnumerator GetEnumerator()
|
||||
{
|
||||
return this.Rows.GetEnumerator();
|
||||
return Rows.GetEnumerator();
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -469,22 +445,22 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
internal void InitVars()
|
||||
{
|
||||
this.columnCustomerID = base.Columns["CustomerID"];
|
||||
columnCustomerID = base.Columns["CustomerID"];
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
private void InitClass()
|
||||
{
|
||||
this.columnCustomerID = new global::System.Data.DataColumn("CustomerID", typeof(string), null, global::System.Data.MappingType.Element);
|
||||
base.Columns.Add(this.columnCustomerID);
|
||||
columnCustomerID = new global::System.Data.DataColumn("CustomerID", typeof(string), null, global::System.Data.MappingType.Element);
|
||||
base.Columns.Add(columnCustomerID);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersRow NewCustomersRow()
|
||||
{
|
||||
return ((CustomersRow)(this.NewRow()));
|
||||
return ((CustomersRow)(NewRow()));
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -506,9 +482,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e)
|
||||
{
|
||||
base.OnRowChanged(e);
|
||||
if ((this.CustomersRowChanged != null))
|
||||
if ((CustomersRowChanged != null))
|
||||
{
|
||||
this.CustomersRowChanged(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
CustomersRowChanged(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,9 +493,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e)
|
||||
{
|
||||
base.OnRowChanging(e);
|
||||
if ((this.CustomersRowChanging != null))
|
||||
if ((CustomersRowChanging != null))
|
||||
{
|
||||
this.CustomersRowChanging(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
CustomersRowChanging(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,9 +504,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e)
|
||||
{
|
||||
base.OnRowDeleted(e);
|
||||
if ((this.CustomersRowDeleted != null))
|
||||
if ((CustomersRowDeleted != null))
|
||||
{
|
||||
this.CustomersRowDeleted(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
CustomersRowDeleted(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,9 +515,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e)
|
||||
{
|
||||
base.OnRowDeleting(e);
|
||||
if ((this.CustomersRowDeleting != null))
|
||||
if ((CustomersRowDeleting != null))
|
||||
{
|
||||
this.CustomersRowDeleting(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
CustomersRowDeleting(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +525,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public void RemoveCustomersRow(CustomersRow row)
|
||||
{
|
||||
this.Rows.Remove(row);
|
||||
Rows.Remove(row);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -631,7 +607,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
///</summary>
|
||||
public partial class CustomersRow : global::System.Data.DataRow
|
||||
{
|
||||
|
||||
private CustomersDataTable tableCustomers;
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -639,7 +614,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
internal CustomersRow(global::System.Data.DataRowBuilder rb) :
|
||||
base(rb)
|
||||
{
|
||||
this.tableCustomers = ((CustomersDataTable)(this.Table));
|
||||
tableCustomers = ((CustomersDataTable)(Table));
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
@@ -650,31 +625,28 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this.tableCustomers.CustomerIDColumn]));
|
||||
return ((string)(this[tableCustomers.CustomerIDColumn]));
|
||||
}
|
||||
catch (global::System.InvalidCastException e)
|
||||
{
|
||||
throw new global::System.Data.StrongTypingException("The value for column \'CustomerID\' in table \'Customers\' is DBNull.", e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this.tableCustomers.CustomerIDColumn] = value;
|
||||
}
|
||||
set { this[tableCustomers.CustomerIDColumn] = value; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public bool IsCustomerIDNull()
|
||||
{
|
||||
return this.IsNull(this.tableCustomers.CustomerIDColumn);
|
||||
return IsNull(tableCustomers.CustomerIDColumn);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public void SetCustomerIDNull()
|
||||
{
|
||||
this[this.tableCustomers.CustomerIDColumn] = global::System.Convert.DBNull;
|
||||
this[tableCustomers.CustomerIDColumn] = global::System.Convert.DBNull;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +656,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public class CustomersRowChangeEvent : global::System.EventArgs
|
||||
{
|
||||
|
||||
private CustomersRow eventRow;
|
||||
|
||||
private global::System.Data.DataRowAction eventAction;
|
||||
@@ -693,30 +664,25 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersRowChangeEvent(CustomersRow row, global::System.Data.DataRowAction action)
|
||||
{
|
||||
this.eventRow = row;
|
||||
this.eventAction = action;
|
||||
eventRow = row;
|
||||
eventAction = action;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public CustomersRow Row
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.eventRow;
|
||||
}
|
||||
get { return eventRow; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
|
||||
public global::System.Data.DataRowAction Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.eventAction;
|
||||
}
|
||||
get { return eventAction; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -35,11 +35,14 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class DateTimeTestClass
|
||||
{
|
||||
public string PreField { get; set; }
|
||||
|
||||
[DefaultValue("")]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DateTime DateTimeField { get; set; }
|
||||
|
||||
public DateTimeOffset DateTimeOffsetField { get; set; }
|
||||
public string PostField { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -41,7 +41,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
public sealed class Event
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// If no current user is specified, returns Nothing (0 from VB)
|
||||
/// </summary>
|
||||
@@ -110,36 +109,43 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
get { return _sublocation; }
|
||||
set { _sublocation = value; }
|
||||
}
|
||||
|
||||
public int userId
|
||||
{
|
||||
get { return _userId; }
|
||||
set { _userId = value; }
|
||||
}
|
||||
|
||||
public EventType type
|
||||
{
|
||||
get { return _type; }
|
||||
set { _type = value; }
|
||||
}
|
||||
|
||||
public string summary
|
||||
{
|
||||
get { return _summary; }
|
||||
set { _summary = value; }
|
||||
}
|
||||
|
||||
public string details
|
||||
{
|
||||
get { return _details; }
|
||||
set { _details = value; }
|
||||
}
|
||||
|
||||
public string stackTrace
|
||||
{
|
||||
get { return _stackTrace; }
|
||||
set { _stackTrace = value; }
|
||||
}
|
||||
|
||||
public string tag
|
||||
{
|
||||
get { return _tag; }
|
||||
set { _tag = value; }
|
||||
}
|
||||
|
||||
public DateTime time
|
||||
{
|
||||
get { return _time; }
|
||||
|
||||
@@ -29,7 +29,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
public class HolderClass
|
||||
{
|
||||
public HolderClass() { }
|
||||
public HolderClass()
|
||||
{
|
||||
}
|
||||
|
||||
[Newtonsoft.Json.JsonProperty(TypeNameHandling = Newtonsoft.Json.TypeNameHandling.All)]
|
||||
public ContentBaseClass TestMember { get; set; }
|
||||
@@ -38,6 +40,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public Dictionary<int, IList<ContentBaseClass>> AnotherTestMember { get; set; }
|
||||
|
||||
public ContentBaseClass AThirdTestMember { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
// customize default values
|
||||
[DefaultValue(30)]
|
||||
public int FollowUpDays { get; set; }
|
||||
|
||||
[DefaultValue("")]
|
||||
public string FollowUpEmailAddress { get; set; }
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
private int _ignoredProperty = 12;
|
||||
|
||||
public int Field;
|
||||
|
||||
public int Property
|
||||
{
|
||||
get { return _property; }
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public string Member { get; set; }
|
||||
|
||||
private string _throwError;
|
||||
|
||||
public string ThrowError
|
||||
{
|
||||
get
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[JsonProperty]
|
||||
public string id { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public List<ListItem> items { get; set; }
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class MemberConverterClass
|
||||
{
|
||||
public DateTime DefaultConverter { get; set; }
|
||||
|
||||
[JsonConverter(typeof(IsoDateTimeConverter))]
|
||||
public DateTime MemberConverter { get; set; }
|
||||
}
|
||||
|
||||
@@ -39,4 +39,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public string PostField { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -36,6 +36,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Age { get; set; }
|
||||
|
||||
public List<string> Roles
|
||||
{
|
||||
get
|
||||
@@ -47,6 +48,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
}
|
||||
set { _roles = value; }
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
[OnError]
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[JsonProperty("PropertyA")]
|
||||
string IPrivateImplementationA.PropertyA
|
||||
{
|
||||
get { return this.PropertyA; }
|
||||
set { this.PropertyA = value; }
|
||||
get { return PropertyA; }
|
||||
set { PropertyA = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,15 +33,15 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[JsonProperty("PropertyB")]
|
||||
string IPrivateImplementationB.PropertyB
|
||||
{
|
||||
get { return this.PropertyB; }
|
||||
set { this.PropertyB = value; }
|
||||
get { return PropertyB; }
|
||||
set { PropertyB = value; }
|
||||
}
|
||||
|
||||
[JsonProperty("OverriddenProperty")]
|
||||
private string OverriddenPropertyString
|
||||
{
|
||||
get { return this.OverriddenProperty.ToString(); }
|
||||
set { this.OverriddenProperty = value; }
|
||||
get { return OverriddenProperty.ToString(); }
|
||||
set { OverriddenProperty = value; }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -50,8 +50,8 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
[JsonIgnore]
|
||||
object IPrivateOverriddenImplementation.OverriddenProperty
|
||||
{
|
||||
get { return this.OverriddenProperty; }
|
||||
set { this.OverriddenProperty = value; }
|
||||
get { return OverriddenProperty; }
|
||||
set { OverriddenProperty = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,12 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class SetOnlyPropertyClass2
|
||||
{
|
||||
private object _value;
|
||||
|
||||
public object SetOnlyProperty
|
||||
{
|
||||
set { _value = value; }
|
||||
}
|
||||
|
||||
public object GetValue()
|
||||
{
|
||||
return _value;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -37,10 +37,13 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public int[] RoomsPerFloor = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
public bool Open = false;
|
||||
public char Symbol = '@';
|
||||
|
||||
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Replace)]
|
||||
public List<string> Mottos = new List<string>();
|
||||
|
||||
public decimal Cost = 100980.1M;
|
||||
public string Escape = "\r\n\t\f\b?{\\r\\n\"\'";
|
||||
|
||||
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Replace)]
|
||||
public List<Product> product = new List<Product>();
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class SubKlass : SuperKlass
|
||||
{
|
||||
public string SubProp { get; set; }
|
||||
public SubKlass(string subprop) { SubProp = subprop; }
|
||||
|
||||
public SubKlass(string subprop)
|
||||
{
|
||||
SubProp = subprop;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,10 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public class SuperKlass
|
||||
{
|
||||
public string SuperProp { get; set; }
|
||||
public SuperKlass() { SuperProp = "default superprop"; }
|
||||
|
||||
public SuperKlass()
|
||||
{
|
||||
SuperProp = "default superprop";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,4 +129,5 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -299,4 +299,5 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -60,4 +60,5 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -31,8 +31,10 @@ namespace Newtonsoft.Json.Bson
|
||||
{
|
||||
Binary = 0x00,
|
||||
Function = 0x01,
|
||||
|
||||
[Obsolete("This type has been deprecated in the BSON specification. Use Binary instead.")]
|
||||
BinaryOld = 0x02,
|
||||
|
||||
[Obsolete("This type has been deprecated in the BSON specification. Use Uuid instead.")]
|
||||
UuidOld = 0x03,
|
||||
Uuid = 0x04,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user