Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2011-08-03 04:50:44 +0400
committerJamesNK <james@newtonking.com>2011-08-03 04:50:44 +0400
commit44ab7f71dfcb4e07b6c1bf59241673a7054a5132 (patch)
treed9bf5077738ca7dfa6cb61fa6143c66753b88ddc /Src/Newtonsoft.Json.Tests/Bson
parent18c9400054ea6581beaa4db9beaba08291bb6826 (diff)
-Fixed DataTable and DataColumn names not being modified by CamelCasePropertyNamesContractResolver
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Bson')
-rw-r--r--Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs49
1 files changed, 48 insertions, 1 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
index a5c3c1d..7548052 100644
--- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
@@ -801,7 +801,54 @@ namespace Newtonsoft.Json.Tests.Bson
reader = new BsonReader(new MemoryStream(bson), false, DateTimeKind.Unspecified);
o = (JObject)JToken.ReadFrom(reader);
- Assert.AreEqual(DateTime.SpecifyKind(value.ToLocalTime(), DateTimeKind.Unspecified), (DateTime)o["DateTime"]);
+ Assert.AreEqual(DateTime.SpecifyKind(value, DateTimeKind.Unspecified), (DateTime)o["DateTime"]);
+ }
+
+ [Test]
+ public void UnspecifiedDateTimeKindHandling()
+ {
+ DateTime value = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Unspecified);
+
+ MemoryStream ms = new MemoryStream();
+ BsonWriter writer = new BsonWriter(ms);
+ writer.DateTimeKindHandling = DateTimeKind.Unspecified;
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("DateTime");
+ writer.WriteValue(value);
+ writer.WriteEndObject();
+
+ byte[] bson = ms.ToArray();
+
+ JObject o;
+ BsonReader reader;
+
+ reader = new BsonReader(new MemoryStream(bson), false, DateTimeKind.Unspecified);
+ o = (JObject)JToken.ReadFrom(reader);
+ Assert.AreEqual(value, (DateTime)o["DateTime"]);
+ }
+
+ [Test]
+ public void LocalDateTimeKindHandling()
+ {
+ DateTime value = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Local);
+
+ MemoryStream ms = new MemoryStream();
+ BsonWriter writer = new BsonWriter(ms);
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("DateTime");
+ writer.WriteValue(value);
+ writer.WriteEndObject();
+
+ byte[] bson = ms.ToArray();
+
+ JObject o;
+ BsonReader reader;
+
+ reader = new BsonReader(new MemoryStream(bson), false, DateTimeKind.Local);
+ o = (JObject)JToken.ReadFrom(reader);
+ Assert.AreEqual(value, (DateTime)o["DateTime"]);
}
private string WriteAndReadStringValue(string val)