public void TestBsonAwesome() { string byteString = @"1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00\x00awesome\x00\x011\x00333333\x14@\x102\x00\xc2\x07\x00\x00\x00\x00"; byte[] bytes = DecodeByteString(byteString); MemoryStream stream = new MemoryStream(bytes); using (BsonReader bsonReader = new BsonBinaryReader(stream)) { bsonReader.ReadStartDocument(); Assert.AreEqual(BsonType.Array, bsonReader.ReadBsonType()); Assert.AreEqual("BSON", bsonReader.ReadName()); bsonReader.ReadStartArray(); Assert.AreEqual(BsonType.String, bsonReader.ReadBsonType()); Assert.AreEqual("awesome", bsonReader.ReadString()); Assert.AreEqual(BsonType.Double, bsonReader.ReadBsonType()); Assert.AreEqual(5.05, bsonReader.ReadDouble()); Assert.AreEqual(BsonType.Int32, bsonReader.ReadBsonType()); Assert.AreEqual(1986, bsonReader.ReadInt32()); bsonReader.ReadEndArray(); bsonReader.ReadEndDocument(); } }