-Fixed DateTimeZoneHandling not being used when writing DateTime dictionary keys
-Buffer pooling fixes -Improved date parsing performance
This commit is contained in:
@@ -7487,6 +7487,34 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual(2, dic2[new DateTime(2013, 12, 12, 12, 12, 12, DateTimeKind.Utc)]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DateTimeDictionaryKey_DateTime_Iso_Local()
|
||||
{
|
||||
IDictionary<DateTime, int> dic1 = new Dictionary<DateTime, int>
|
||||
{
|
||||
{ new DateTime(2000, 12, 12, 12, 12, 12, DateTimeKind.Utc), 1 },
|
||||
{ new DateTime(2013, 12, 12, 12, 12, 12, DateTimeKind.Utc), 2 }
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(dic1, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Local
|
||||
});
|
||||
|
||||
JObject o = JObject.Parse(json);
|
||||
Assert.IsFalse(o.Properties().ElementAt(0).Name.Contains("Z"));
|
||||
Assert.IsFalse(o.Properties().ElementAt(1).Name.Contains("Z"));
|
||||
|
||||
IDictionary<DateTime, int> dic2 = JsonConvert.DeserializeObject<IDictionary<DateTime, int>>(json, new JsonSerializerSettings
|
||||
{
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc
|
||||
});
|
||||
|
||||
Assert.AreEqual(2, dic2.Count);
|
||||
Assert.AreEqual(1, dic2[new DateTime(2000, 12, 12, 12, 12, 12, DateTimeKind.Utc)]);
|
||||
Assert.AreEqual(2, dic2[new DateTime(2013, 12, 12, 12, 12, 12, DateTimeKind.Utc)]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DateTimeDictionaryKey_DateTime_MS()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user