-Removed Windows Phone from build

-Performance
This commit is contained in:
James Newton-King
2013-04-08 22:53:45 +12:00
parent 164edc1db8
commit a871e6e0e1
8 changed files with 98 additions and 14 deletions
@@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
#if !NETFX_CORE
using NUnit.Framework;
@@ -67,6 +68,14 @@ namespace Newtonsoft.Json.Tests.Serialization
}
}
public class EscapedPropertiesContractResolver : DefaultContractResolver
{
protected internal override string ResolvePropertyName(string propertyName)
{
return base.ResolvePropertyName(propertyName + @"-'-""-");
}
}
public class Book
{
public string BookName { get; set; }
@@ -99,6 +108,28 @@ namespace Newtonsoft.Json.Tests.Serialization
[TestFixture]
public class ContractResolverTests : TestFixtureBase
{
[Test]
public void SerializeWithEscapedPropertyName()
{
string json = JsonConvert.SerializeObject(
new AddressWithDataMember
{
AddressLine1 = "value!"
},
new JsonSerializerSettings
{
ContractResolver = new EscapedPropertiesContractResolver()
});
Assert.AreEqual(@"{""AddressLine1-'-\""-"":""value!""}", json);
JsonTextReader reader = new JsonTextReader(new StringReader(json));
reader.Read();
reader.Read();
Assert.AreEqual(@"AddressLine1-'-""-", reader.Value);
}
#if !NET20
[Test]
public void DeserializeDataMemberClassWithNoDataContract()