mausch/SolrNet — pull request #31 by yorah (2011-12-13 16:12:45+00:00)
Title: Issue 37: MappingManager with class hierarchy 

Hey,

I just started toying with the SolrNet codebase, so I took the opportunity to fix in Ignored test.

There is one use case where the code would produce an expected behavior: if the same property has been registered twice in the MappingManager (one time for the subclass, and one time for the base class).

[Test]
[Ignore("Linked to issue 37, not sure what the expected behavior would be.")]
public void Inherited_with_redefined_properties_mappings()
{
var mgr = new MappingManager();
mgr.Add(typeof(Entity).GetProperty("Id"), "id");
mgr.Add(typeof(InheritedEntity).GetProperty("Id"), "id2");
mgr.Add(typeof(InheritedEntity).GetProperty("Description"), "desc");
var entityFields = mgr.GetFields(typeof(Entity));
Assert.AreEqual(1, entityFields.Count);
var inheritedEntityFields = mgr.GetFields(typeof(InheritedEntity));
Assert.AreEqual(2, inheritedEntityFields.Count); // Currently returns 3
}

My guess is that in that case, the returned fields should be the ones at the top of the hierarchy chain when there are several candidates (e.g.: in the test above, we should return only "Id2" and "desc").

What do you think?