diff options
author | JamesNK <james@newtonking.com> | 2012-02-03 06:31:56 +0400 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2012-02-03 06:31:56 +0400 |
commit | 6ce847411a78b61cbf3597a0299b7b4006bcc9c7 (patch) | |
tree | 9ce7f54a27ef230c7734a6dcd5940139a02e1277 /Src/Newtonsoft.Json.Tests/Bson | |
parent | c5f1074e701a91002ce58b32993c18c4346cddb0 (diff) |
-Fixed attributes on nullable structs not being used
-Fixed deserializing nullable enums
-Fixed JsonConstructorAttribute incorrectly being allowed on properties
-Added new NUnit
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Bson')
-rw-r--r-- | Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs index 00ed770..d57e264 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs @@ -264,6 +264,30 @@ namespace Newtonsoft.Json.Tests.Bson }
[Test]
+ [ExpectedException(typeof(JsonReaderException), ExpectedMessage = "Could not convert string to integer: a.")]
+ public void ReadAsInt32BadString()
+ {
+ byte[] data = MiscellaneousUtils.HexToBytes("20-00-00-00-02-30-00-02-00-00-00-61-00-02-31-00-02-00-00-00-62-00-02-32-00-02-00-00-00-63-00-00");
+
+ MemoryStream ms = new MemoryStream(data);
+ BsonReader reader = new BsonReader(ms);
+
+ Assert.AreEqual(false, reader.ReadRootValueAsArray);
+ Assert.AreEqual(DateTimeKind.Local, reader.DateTimeKindHandling);
+
+ reader.ReadRootValueAsArray = true;
+ reader.DateTimeKindHandling = DateTimeKind.Utc;
+
+ Assert.AreEqual(true, reader.ReadRootValueAsArray);
+ Assert.AreEqual(DateTimeKind.Utc, reader.DateTimeKindHandling);
+
+ Assert.IsTrue(reader.Read());
+ Assert.AreEqual(JsonToken.StartArray, reader.TokenType);
+
+ reader.ReadAsInt32();
+ }
+
+ [Test]
public void ReadBytes()
{
byte[] data = MiscellaneousUtils.HexToBytes("2B-00-00-00-02-30-00-02-00-00-00-61-00-02-31-00-02-00-00-00-62-00-05-32-00-0C-00-00-00-02-48-65-6C-6C-6F-20-77-6F-72-6C-64-21-00");
|