public void TestGetDocumentId() { #pragma warning disable 618 var expectedId = new BsonObjectId(ObjectId.GenerateNewId()); var wrapper = new BsonDocumentWrapper(new BsonDocument("_id", expectedId)); Assert.AreEqual(false, wrapper.IsMaterialized); object id; Type idNominalType; IIdGenerator idGenerator; wrapper.GetDocumentId(out id, out idNominalType, out idGenerator); Assert.AreEqual(true, wrapper.IsMaterialized); Assert.IsInstanceOf <BsonObjectId>(id); Assert.AreEqual(expectedId, id); Assert.AreSame(typeof(BsonValue), idNominalType); Assert.IsInstanceOf <BsonObjectIdGenerator>(idGenerator); #pragma warning restore }