public void TestSetElementByName() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.AreEqual(false, wrapper.IsMaterialized); wrapper.SetElement(new BsonElement("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]); }