-Fixed JTokenWriter not writing comments

-Fixed BsonWriter not erroring when writing non-BSON compatible content
This commit is contained in:
JamesNK
2009-12-20 00:16:02 +00:00
parent b6ff852467
commit f574bfbf83
5 changed files with 239 additions and 22 deletions
@@ -572,5 +572,29 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.IsFalse(reader.Read());
}
[Test]
public void ReadEmptyStrings()
{
string bson = "0C-00-00-00-02-00-01-00-00-00-00-00";
BsonReader reader = new BsonReader(new MemoryStream(MiscellaneousUtils.HexToBytes(bson)));
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.AreEqual("", reader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.AreEqual("", reader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.EndObject, reader.TokenType);
Assert.IsFalse(reader.Read());
}
}
}