-Fixed test error when tests run in UTC timezone

-Fixed globalization warnings
-Fixed SelectToken skipping last property name if it is a single character
This commit is contained in:
JamesNK
2010-09-29 06:14:30 +00:00
parent 6591f7f29a
commit 4cea6d3c09
11 changed files with 35 additions and 11 deletions
@@ -272,8 +272,16 @@ namespace Newtonsoft.Json.Tests.Converters
c.DateTimeField = new DateTime(2008, 1, 1, 1, 1, 1, 0, DateTimeKind.Utc);
string json2 = JsonConvert.SerializeObject(c, new IsoDateTimeConverter() { DateTimeStyles = DateTimeStyles.AssumeUniversal });
TimeSpan offset;
#if SILVERLIGHT
offset = TimeZoneInfo.Local.GetUtcOffset(localDateTime);
#else
offset = TimeZone.CurrentTimeZone.GetUtcOffset(localDateTime);
#endif
// if the current timezone is utc then local already equals utc
if (TimeZone.CurrentTimeZone.GetUtcOffset(localDateTime) == TimeSpan.Zero)
if (offset == TimeSpan.Zero)
Assert.AreEqual(json, json2);
else
Assert.AreNotEqual(json, json2);