-Changed serialization callbacks on JsonContract to delegates

-Added Obsolete attributes to old serialization methods on JsonContract
-Added VS and ReSharper settings files
-Fixed converting null JSON value to XML
-Fixed tests
This commit is contained in:
James Newton-King
2013-03-17 14:25:01 +13:00
parent 1356c31670
commit e857e48564
13 changed files with 182 additions and 112 deletions
@@ -711,7 +711,7 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
Assert.AreEqual(new byte[] { 246, 255, 255, 255, 255, 255, 255, 31, 178, 33, 203, 40, 89, 132, 196, 174, 3, 138, 68, 52, 47, 76, 78, 158, 62, 1 }, reader.Value);
CollectionAssert.AreEqual(new byte[] { 246, 255, 255, 255, 255, 255, 255, 31, 178, 33, 203, 40, 89, 132, 196, 174, 3, 138, 68, 52, 47, 76, 78, 158, 62, 1 }, (byte[])reader.Value);
Assert.AreEqual(i, new BigInteger((byte[])reader.Value));
Assert.IsTrue(reader.Read());
@@ -1902,6 +1902,27 @@ namespace Newtonsoft.Json.Tests.Converters
Assert.AreEqual(@"{""root"":{""@xmlns"":""http://www.example.com/ns"",""a"":null,""bns:b"":{""@xmlns:bns"":""http://www.example.com/ns""},""c"":null}}", json2);
#endif
}
#if !NET20
class NullableXml
{
public string Name;
public XElement notNull;
public XElement isNull;
}
[Test]
public void SerializeAndDeserializeNullableXml()
{
var xml = new NullableXml { Name = "test", notNull = XElement.Parse("<root>test</root>") };
var json = JsonConvert.SerializeObject(xml);
var w2 = JsonConvert.DeserializeObject<NullableXml>(json);
Assert.AreEqual(xml.Name, w2.Name);
Assert.AreEqual(xml.isNull, w2.isNull);
Assert.AreEqual(xml.notNull.ToString(), w2.notNull.ToString());
}
#endif
}
}
#endif
@@ -368,7 +368,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual("9223372036854775807", (string)(new JValue(new BigInteger(long.MaxValue))));
intData = (byte[]) (new JValue(new BigInteger(long.MaxValue)));
Assert.AreEqual(new byte[] { 255, 255, 255, 255, 255, 255, 255, 127 }, intData);
CollectionAssert.AreEqual(new byte[] { 255, 255, 255, 255, 255, 255, 255, 127 }, intData);
#endif
}
@@ -75,4 +75,4 @@ 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.1.15916")]
[assembly: AssemblyFileVersion("5.0.1.15917")]