Skip to content

Commit

Permalink
Merge pull request #63 from emiaj/indexer_test
Browse files Browse the repository at this point in the history
Indexer test
  • Loading branch information
jeremydmiller committed Feb 20, 2013
2 parents c635657 + a163310 commit dfa701b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/FubuCore.Testing/Reflection/ReflectionHelperTester.cs
Expand Up @@ -320,9 +320,10 @@ public void get_value_by_indexer_when_the_indexer_is_variable_reference_of_a_com
public void get_owner_type_by_indexer()
{
var accessor = ReflectionHelper.GetAccessor<Target>(x => x.Child.Grandchildren[1].Deep.Color);
accessor.OwnerType.ShouldEqual(typeof (DeepTarget));
accessor.OwnerType.ShouldEqual(typeof(DeepTarget));

ReflectionHelper.GetAccessor<Target>(x => x.Child.Grandchildren[1]).OwnerType.ShouldEqual(typeof(ChildTarget));
ReflectionHelper.GetAccessor<Target>(x => x.Child.Grandchildren[1].Name).OwnerType.ShouldEqual(typeof(GrandChildTarget));
}

[Test]
Expand Down
3 changes: 2 additions & 1 deletion src/FubuCore/Reflection/PropertyChain.cs
Expand Up @@ -67,7 +67,8 @@ public Type OwnerType
}

var propertyGetter = _chain.Last() as PropertyValueGetter;
return propertyGetter != null ? propertyGetter.PropertyInfo.PropertyType : null;
if (propertyGetter != null) return propertyGetter.PropertyInfo.PropertyType;
return InnerProperty != null ? InnerProperty.DeclaringType : null;
}
}

Expand Down

0 comments on commit dfa701b

Please sign in to comment.