public void CanSerializeStringGenericDictionaryWithComplexType() { var expectedBson = Serialize <Document>(new Document("Dict", new Document { { "key1", new Document("Name", "a") }, { "key2", new Document("Name", "b") } })); var obj = new GenericStringDictionaryWithComplexType { Dict = new Dictionary <string, GenericDictionaryComplexType> { { "key1", new GenericDictionaryComplexType { Name = "a" } }, { "key2", new GenericDictionaryComplexType { Name = "b" } } } }; var bson = Serialize <GenericStringDictionaryWithComplexType>(obj); Assert.AreEqual(expectedBson, bson); }
public void CanSerializeStringGenericDictionaryWithComplexType() { var expectedBson = Serialize<Document>(new Document("Dict", new Document { { "key1", new Document("Name", "a") }, { "key2", new Document("Name", "b") } })); var obj = new GenericStringDictionaryWithComplexType { Dict = new Dictionary<string, GenericDictionaryComplexType> { { "key1", new GenericDictionaryComplexType { Name = "a" } }, { "key2", new GenericDictionaryComplexType { Name = "b" } } } }; var bson = Serialize<GenericStringDictionaryWithComplexType>(obj); Assert.AreEqual(expectedBson, bson); }