Exemple #1
0
        public void CanSerializeIntGenericDictionaryWithComplexType()
        {
            var expectedBson = Serialize <Document>(new Document("Dict", new Document {
                { "1", new Document("Name", "a") }, { "2", new Document("Name", "b") }
            }));
            var obj = new GenericIntDictionaryWithComplexType {
                Dict = new Dictionary <int, GenericDictionaryComplexType> {
                    { 1, new GenericDictionaryComplexType {
                          Name = "a"
                      } }, { 2, new GenericDictionaryComplexType {
                                 Name = "b"
                             } }
                }
            };
            var bson = Serialize <GenericIntDictionaryWithComplexType>(obj);

            Assert.AreEqual(expectedBson, bson);
        }
 public void CanSerializeIntGenericDictionaryWithComplexType()
 {
     var expectedBson = Serialize<Document>(new Document("Dict", new Document { { "1", new Document("Name", "a") }, { "2", new Document("Name", "b") } }));
     var obj = new GenericIntDictionaryWithComplexType { Dict = new Dictionary<int, GenericDictionaryComplexType> { { 1, new GenericDictionaryComplexType { Name = "a" } }, { 2, new GenericDictionaryComplexType { Name = "b" } } } };
     var bson = Serialize<GenericIntDictionaryWithComplexType>(obj);
     Assert.AreEqual(expectedBson, bson);
 }