forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using MbUnit.Framework; | ||
using SolrNet.Attributes; | ||
using SolrNet.Impl; | ||
using SolrNet.Impl.DocumentPropertyVisitors; | ||
using SolrNet.Impl.FieldParsers; | ||
using SolrNet.Mapping; | ||
using SolrNet.Tests.Utils; | ||
|
||
namespace SolrNet.Tests { | ||
[TestFixture] | ||
public class GenericDictionaryDocumentVisitorTests { | ||
|
||
[Test] | ||
public void ParseDictionaryOfCollection() { | ||
var xml = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.docWithDynamicFields.xml"); | ||
var mapper = new AttributesMappingManager(); | ||
var parser = new SolrDocumentResponseParser<Entity>(mapper, new DefaultDocumentVisitor(mapper, new DefaultFieldParser()), new SolrDocumentActivator<Entity>()); | ||
var entity = parser.ParseDocument(xml.Root); | ||
Assert.IsNotNull(entity, "entity was null"); | ||
Assert.IsNotNull(entity.Attributes, "attributes was null"); | ||
Assert.AreEqual(16, entity.Attributes.Count); | ||
|
||
var attr2 = entity.Attributes["2"]; | ||
Assert.AreEqual(5, attr2.Count); | ||
Assert.Contains(attr2, 63); | ||
Assert.Contains(attr2, 64); | ||
Assert.Contains(attr2, 65); | ||
Assert.Contains(attr2, 66); | ||
Assert.Contains(attr2, 102); | ||
} | ||
|
||
class Entity { | ||
[SolrField("attr_")] | ||
public IDictionary<string, ICollection<int>> Attributes { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- https://github.com/mausch/SolrNet/issues/211 --> | ||
<doc> | ||
<arr name="attr_6"> | ||
<int>31</int> | ||
</arr> | ||
<arr name="attr_2"> | ||
<int>63</int> | ||
<int>64</int> | ||
<int>65</int> | ||
<int>66</int> | ||
<int>102</int> | ||
</arr> | ||
<arr name="attr_1"> | ||
<int>69</int> | ||
</arr> | ||
<arr name="attr_9"> | ||
<int>224</int> | ||
</arr> | ||
<arr name="attr_5"> | ||
<int>226</int> | ||
</arr> | ||
<arr name="attr_8"> | ||
<int>236</int> | ||
</arr> | ||
<arr name="attr_11"> | ||
<int>243</int> | ||
</arr> | ||
<arr name="attr_20"> | ||
<int>557</int> | ||
</arr> | ||
<arr name="attr_4"> | ||
<int>1349</int> | ||
</arr> | ||
<arr name="attr_3"> | ||
<int>2144</int> | ||
</arr> | ||
<arr name="attr_23"> | ||
<int>2472</int> | ||
</arr> | ||
<arr name="attr_13"> | ||
<int>2556</int> | ||
</arr> | ||
<arr name="attr_18"> | ||
<int>2894</int> | ||
</arr> | ||
<arr name="attr_22"> | ||
<int>3881</int> | ||
</arr> | ||
<arr name="attr_21"> | ||
<int>3882</int> | ||
</arr> | ||
<arr name="attr_26"> | ||
<int>3998</int> | ||
</arr> | ||
</doc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters