public void TestAddRangeIDictionary()
        {
            var wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange(new Dictionary<string, object>());
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(0, wrapper.ElementCount);

            wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange((IDictionary)(new Dictionary<string, object> { { "x", 1 } }));
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(1, wrapper.ElementCount);
            Assert.AreEqual("x", wrapper.GetElement(0).Name);
            Assert.AreEqual(new BsonInt32(1), wrapper[0]);
        }
        public void TestAddRangeKeyValuePairs()
        {
            var wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange(new KeyValuePair<string, object>[0]);
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(0, wrapper.ElementCount);

            wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange(new[] { new KeyValuePair<string, object>("x", 1) });
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(1, wrapper.ElementCount);
            Assert.AreEqual("x", wrapper.GetElement(0).Name);
            Assert.AreEqual(new BsonInt32(1), wrapper[0]);
        }
        public void TestAddRangeElements()
        {
            var wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange(new BsonElement[0]);
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(0, wrapper.ElementCount);

            wrapper = new BsonDocumentWrapper(new BsonDocument());
            Assert.AreEqual(false, wrapper.IsMaterialized);
            wrapper.AddRange(new[] { new BsonElement("x", 1) });
            Assert.AreEqual(true, wrapper.IsMaterialized);
            Assert.AreEqual(1, wrapper.ElementCount);
            Assert.AreEqual("x", wrapper.GetElement(0).Name);
            Assert.AreEqual(new BsonInt32(1), wrapper[0]);
        }