public void TestDictionarySerializedAsArrayOfDocuments() { var c = new C3 { D = new Dictionary <string, object> { { "x", 1 } } }; var json = c.ToJson(); var expected = "{ 'D' : [{ 'k' : 'x', 'v' : 1 }] }".Replace("'", "\""); Assert.Equal(expected, json); var r = BsonSerializer.Deserialize <C3>(json); Assert.Equal(1, r.D.Count); Assert.Equal(1, r.D["x"]); }
public void TestDictionarySerializedAsArrayOfDocuments() { var c = new C3 { D = new Dictionary<string, object> { { "x", 1 } } }; var json = c.ToJson(); var expected = "{ 'D' : [{ 'k' : 'x', 'v' : 1 }] }".Replace("'", "\""); Assert.AreEqual(expected, json); var r = BsonSerializer.Deserialize<C3>(json); Assert.AreEqual(1, r.D.Count); Assert.AreEqual(1, r.D["x"]); }