Skip to content

Commit

Permalink
Add failing test for Dictionary serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanwin committed May 14, 2010
1 parent 6f2907b commit 6990f9b
Showing 1 changed file with 22 additions and 0 deletions.
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using MongoDB.Configuration;
using MongoDB.Serialization;
using NUnit.Framework;
Expand Down Expand Up @@ -114,5 +115,26 @@ public void CanSetValueOnNullablPropertys()
Assert.IsNotNull(obj);
Assert.AreEqual(10,obj.Value);
}

public class DictionaryProperty
{
public Dictionary<string, string> Test { get; set; }
}

[Test]
public void CanSerializeAndDeserializeDictionarys()
{
var dict = new DictionaryProperty
{
Test = new Dictionary<string, string> {{"test", "test"}}
};
var bson = Serialize<DictionaryProperty>(dict);

var prop = Deserialize<DictionaryProperty>(bson);

Assert.IsNotNull(prop);
Assert.IsNotNull(prop.Test);
Assert.Contains(new KeyValuePair<string,string>("test","test"),prop.Test);
}
}
}

0 comments on commit 6990f9b

Please sign in to comment.