public void TestGetValueByNameWithDefaultValue() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.AreEqual(false, wrapper.IsMaterialized); var x = wrapper.GetValue("x", 2); var y = wrapper.GetValue("y", 2); Assert.AreEqual(true, wrapper.IsMaterialized); Assert.AreEqual(new BsonInt32(1), x); Assert.AreEqual(new BsonInt32(2), y); }
public void TestGetValueByName() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.AreEqual(false, wrapper.IsMaterialized); var value = wrapper.GetValue("x"); Assert.AreEqual(true, wrapper.IsMaterialized); Assert.AreEqual(new BsonInt32(1), value); }