public void TestSetByName() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.AreEqual(false, wrapper.IsMaterialized); wrapper.Set("x", 2); Assert.AreEqual(true, wrapper.IsMaterialized); Assert.AreEqual(1, wrapper.ElementCount); Assert.AreEqual("x", wrapper.GetElement(0).Name); Assert.AreEqual(new BsonInt32(2), wrapper[0]); }