-Fixed build

This commit is contained in:
James Newton-King
2012-11-04 21:31:20 +13:00
parent c06c7b8aae
commit 12b60f2fca
2 changed files with 31 additions and 30 deletions
@@ -44,6 +44,12 @@ namespace Newtonsoft.Json.Tests.Converters
[TestFixture]
public class JsonValueConverterTests : TestFixtureBase
{
public class Computer
{
public string Cpu { get; set; }
public List<string> Drives { get; set; }
}
[Test]
public void WriteJson()
{
@@ -270,17 +276,19 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void DeserializePerformance()
{
Stopwatch timer = new Stopwatch();
timer.Start();
for (int i = 0; i < 100000; i++)
{
JsonObject o = JsonObject.Parse(@"{
string json = @"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
}";
Stopwatch timer = new Stopwatch();
timer.Start();
for (int i = 0; i < 100000; i++)
{
JsonObject o = JsonObject.Parse(json);
}
timer.Stop();
@@ -290,29 +298,20 @@ namespace Newtonsoft.Json.Tests.Converters
timer.Start();
for (int i = 0; i < 100000; i++)
{
JObject o = JObject.Parse(@"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
JObject o = JObject.Parse(json);
}
timer.Stop();
string linq = timer.Elapsed.TotalSeconds.ToString();
// warm up
JsonConvert.DeserializeObject<Computer>(json);
timer = new Stopwatch();
timer.Start();
for (int i = 0; i < 100000; i++)
{
JsonObject o = JsonConvert.DeserializeObject<JsonObject>(@"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
Computer o = JsonConvert.DeserializeObject<Computer>(json);
}
timer.Stop();
@@ -326,21 +325,17 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void SerializePerformance()
{
JsonObject o = JsonObject.Parse(@"{
string json = @"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
}";
JObject o1 = JObject.Parse(@"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
JsonObject o = JsonObject.Parse(json);
JObject o1 = JObject.Parse(json);
Computer o2 = JsonConvert.DeserializeObject<Computer>(json);
Stopwatch timer = new Stopwatch();
timer.Start();
+7 -1
View File
@@ -161,7 +161,13 @@ namespace Newtonsoft.Json.Utilities
bool hasNext = (i + 1 < s.Length);
if ((i == 0 || !hasNext) || char.IsUpper(s[i + 1]))
{
char lowerCase = char.ToLower(s[i], CultureInfo.InvariantCulture);
char lowerCase;
#if !NETFX_CORE
lowerCase = char.ToLower(s[i], CultureInfo.InvariantCulture);
#else
lowerCase = char.ToLower(s[i]);
#endif
sb.Append(lowerCase);
}
else