public void TestHashtableSerializedAsArrayOfDocuments() { var d = new D3 { H = new Hashtable { { "x", 1 } } }; var json = d.ToJson(); var expected = "{ 'H' : [{ 'k' : 'x', 'v' : 1 }] }".Replace("'", "\""); Assert.Equal(expected, json); var r = BsonSerializer.Deserialize <D3>(json); Assert.Equal(1, r.H.Count); Assert.Equal(1, r.H["x"]); }
public void TestHashtableSerializedAsArrayOfDocuments() { var d = new D3 { H = new Hashtable { { "x", 1 } } }; var json = d.ToJson(); var expected = "{ 'H' : [{ 'k' : 'x', 'v' : 1 }] }".Replace("'", "\""); Assert.AreEqual(expected, json); var r = BsonSerializer.Deserialize<D3>(json); Assert.AreEqual(1, r.H.Count); Assert.AreEqual(1, r.H["x"]); }