public void TestAddNameValue() { var wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.Add("x", 1); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(1, wrapper.ElementCount); Assert.Equal("x", wrapper.GetElement(0).Name); Assert.Equal(new BsonInt32(1), wrapper[0]); }
public void TestAddNameValueFactoryWithCondition() { var wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.Add("x", () => 1, false); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(0, wrapper.ElementCount); wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.Add("x", () => 1, true); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(1, wrapper.ElementCount); Assert.Equal("x", wrapper.GetElement(0).Name); Assert.Equal(new BsonInt32(1), wrapper[0]); }