Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove DocumentDictionaryAdapter since Documents are a special case. …

…This fix the failing embedded document tests.
  • Loading branch information...
commit cf2bb52212d0739675c930e0a0fdf1e2c059d49e 1 parent ed91b95
Steve Wagner lanwin authored
5 source/MongoDB.Tests/UnitTests/Serialization/SerializationFactoryTests.cs
View
@@ -301,14 +301,15 @@ public class EmbeddedDocumentHelper
[Test]
public void CanReadEmbeddedDocument()
{
- var bson = Serialize(new Document("Document", new Document("value", 10)));
+ var bson = Serialize(new Document("Document", new Document("Embedded",new Document("value", 10))));
var helper = Deserialize<EmbeddedDocumentHelper>(bson);
Assert.IsNotNull(helper);
Assert.IsNotNull(helper.Document);
Assert.AreEqual(1, helper.Document.Count);
- var embedded = helper.Document["Document"] as Document;
+
+ var embedded = helper.Document["Embedded"] as Document;
Assert.IsNotNull(embedded);
Assert.AreEqual(1, embedded.Count);
Assert.AreEqual(10, embedded["value"]);
48 source/MongoDB/Configuration/DictionaryAdapters/DocumentDictionaryAdapter.cs
View
@@ -1,48 +0,0 @@
-using System;
-
-namespace MongoDB.Configuration.DictionaryAdapters
-{
- /// <summary>
- ///
- /// </summary>
- public class DocumentDictionaryAdapter : IDictionaryAdapter
- {
- /// <summary>
- /// Gets the type of the key.
- /// </summary>
- /// <value>The type of the key.</value>
- public Type KeyType
- {
- get { return typeof(string); }
- }
-
- /// <summary>
- /// Gets the type of the value.
- /// </summary>
- /// <value>The type of the value.</value>
- public Type ValueType
- {
- get { return typeof(object); }
- }
-
- /// <summary>
- /// Creates the dictionary.
- /// </summary>
- /// <param name="document">The document.</param>
- /// <returns></returns>
- public object CreateDictionary(Document document)
- {
- return document;
- }
-
- /// <summary>
- /// Gets the pairs.
- /// </summary>
- /// <param name="dictionary">The collection.</param>
- /// <returns></returns>
- public Document GetDocument(object dictionary)
- {
- return dictionary as Document;
- }
- }
-}
6 source/MongoDB/Configuration/Mapping/Conventions/DefaultDictionaryAdapterConvention.cs
View
@@ -13,7 +13,6 @@ public class DefaultDictionaryAdapterConvention : IDictionarynAdapterConvention
/// </summary>
private static readonly Dictionary<Type, DictionaryTypeFactoryDelegate> DictionaryTypes = new Dictionary<Type, DictionaryTypeFactoryDelegate>
{
- {typeof(Document), CreateDocumentType},
{typeof(IDictionary), CreateHashtableType},
{typeof(Hashtable), CreateHashtableType},
{typeof(IEnumerable<DictionaryEntry>), CreateHashtableType}
@@ -61,11 +60,6 @@ public IDictionaryAdapter GetDictionaryAdapter(Type type)
return null;
}
- private static IDictionaryAdapter CreateDocumentType()
- {
- return new DocumentDictionaryAdapter();
- }
-
private static IDictionaryAdapter CreateHashtableType()
{
return new HashtableDictionaryAdapter();
1  source/MongoDB/MongoDB.csproj
View
@@ -118,7 +118,6 @@
<Compile Include="Configuration\DictionaryAdapters\GenericDictionaryDictionaryAdapter.cs" />
<Compile Include="Configuration\DictionaryAdapters\GenericSortedListDictionaryAdapter.cs" />
<Compile Include="Configuration\DictionaryAdapters\HashtableDictionaryAdapter.cs" />
- <Compile Include="Configuration\DictionaryAdapters\DocumentDictionaryAdapter.cs" />
<Compile Include="Configuration\DictionaryAdapters\IDictionaryAdapter.cs" />
<Compile Include="Configuration\Mapping\Auto\IdOverrides.cs" />
<Compile Include="Configuration\Mapping\Conventions\DefaultDictionaryAdapterConvention.cs" />
Please sign in to comment.
Something went wrong with that request. Please try again.