Exemplo n.º 1
0
        public void TestGenericDictionaryDocumentRepresentationWithDollar()
        {
            var d = new GDD { Id = 1, Data = new Dictionary<string, int> { { "$a", 1 } } };
            var expected = "{ '_id' : 1, 'Data' : { '$a' : 1 } }".Replace("'", "\"");
            var json = d.ToJson();
            Assert.AreEqual(expected, json);

            Assert.Throws<BsonSerializationException>(() => { _collection.Insert(d); });
        }