public void TestAddRangeKeyValuePairs() { var wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange(new KeyValuePair <string, object> [0]); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(0, wrapper.ElementCount); wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange(new[] { new KeyValuePair <string, object>("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 TestAddRangeElements() { var wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange(new BsonElement[0]); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(0, wrapper.ElementCount); wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange(new[] { new BsonElement("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 TestAddRangeIDictionary() { var wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange(new Dictionary <string, object>()); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(0, wrapper.ElementCount); wrapper = new BsonDocumentWrapper(new BsonDocument()); Assert.Equal(false, wrapper.IsMaterialized); wrapper.AddRange((IDictionary)(new Dictionary <string, object> { { "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]); }