-Fixed attributes on nullable structs not being used
-Fixed deserializing nullable enums -Fixed JsonConstructorAttribute incorrectly being allowed on properties -Added new NUnit
This commit is contained in:
@@ -263,6 +263,30 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
Assert.IsFalse(reader.Read());
|
||||
}
|
||||
|
||||
[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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user